Changeset 525 for trunk/src


Ignore:
Timestamp:
May 17, 2017, 8:46:51 PM (8 years ago)
Author:
katerina
Message:

Log error if the close() on the baseline database fails (ticket #420).

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_cat.c

    r481 r525  
    7272  { MSG_CHECK_2,     SH_ERR_STAMP,   STAMP, N_("msg=\"File check starting.\"")},
    7373  { MSG_STAMP,       SH_ERR_STAMP,   STAMP, N_("msg=\"---- TIMESTAMP ----\"")},
    74 
     74  { MSG_DCLOSE,      SH_ERR_NOTICE,  RUN,   N_("msg=\"Finished writing baseline database.\"")},
     75 
    7576  { MSG_D_START,     SH_ERR_INFO,    RUN,   N_("msg=\"Downloading configuration file\"")},
    7677  { MSG_D_DSTART,    SH_ERR_INFO,    RUN,   N_("msg=\"Downloading database file\"")},
     
    403404  { MSG_CHECK_2,     SH_ERR_STAMP,   STAMP, N_("msg=<File check starting.>")},
    404405  { MSG_STAMP,       SH_ERR_STAMP,   STAMP, N_("msg=<---- TIMESTAMP ---->")},
     406  { MSG_DCLOSE,      SH_ERR_NOTICE,  RUN,   N_("msg=<Finished writing baseline database.>")},
    405407
    406408  { MSG_D_START,     SH_ERR_INFO,    RUN,   N_("msg=<Downloading configuration file>")},
  • trunk/src/sh_dbIO.c

    r491 r525  
    152152}
    153153
     154/* Seek to [SOF] and truncate remainder of file
     155 */
    154156static int sh_dbIO_setdataent_old (SL_TICKET fd, char * line, int size,
    155157                                   const char * file)
     
    11171119}
    11181120
     1121/* Seek to [SOF] and truncate remainder
     1122 */
    11191123static int seek_writeout_data_old(SL_TICKET fd, const char * path)
    11201124{
    11211125  char * line = SH_ALLOC(MAX_PATH_STORE+1);
    11221126
     1127  /* This will do an ftruncate() after the sof marker
     1128   */
    11231129  if (SL_ISERROR(sh_dbIO_setdataent_old (fd, line, MAX_PATH_STORE, path)))
    11241130    {
    11251131      SH_FREE(line);
    11261132      sh_error_handle((-1), FIL__, __LINE__, 0, MSG_E_SUBGPATH,
    1127                       _("Failed to seek to end of baseline database"),
     1133                      _("Failed to seek to start of baseline database"),
    11281134                      _("seek_writeout_data_old"),
    11291135                      path);
     
    14141420            {
    14151421              pushdata_fd = open_writeout_data(outpath);
     1422              /* Seek to eof */
    14161423              seek_writeout_data(pushdata_fd, outpath);
    14171424            }
     
    14241431          TPT((0, FIL__, __LINE__, _("msg=<Update.>\n")));
    14251432          pushdata_fd = open_writeout_data(outpath);
     1433          /* Seek to sof and truncate */
    14261434          seek_writeout_data_old(pushdata_fd, outpath);
    14271435        }
     
    14791487      if (sh.flag.checkSum != SH_CHECK_INIT || (buf == NULL && fileHash == NULL))
    14801488        {
    1481           sl_close (pushdata_fd);
     1489          if (SL_ISERROR(sl_close (pushdata_fd)))
     1490            {
     1491              char * tmp = sh_util_safe_name(outpath);
     1492              sh_error_handle((-1), FIL__, __LINE__, 0, MSG_E_SUBGPATH,
     1493                              _("Failed to close baseline database"),
     1494                              _("sh_dbIO_data_write_int"),
     1495                              tmp);
     1496              SH_FREE(tmp);
     1497            }
     1498          else {
     1499            if (sh.flag.checkSum == SH_CHECK_INIT)
     1500              sh_error_handle((-1), FIL__, __LINE__, 0, MSG_DCLOSE);
     1501          }
    14821502          pushdata_fd = -1;
    14831503        }
  • trunk/src/slib.c

    r523 r525  
    23832383               _("msg=<Error fclosing file.>, fd=<%d>, err=<%s>\n"),
    23842384               fd, strerror(errno)));
     2385          SL_IRETURN(SL_ECLOSE, _("sl_close"));
    23852386        }
    23862387    }
     
    23922393               _("msg=<Error closing file.>, fd=<%d>, err=<%s>\n"),
    23932394               fd, strerror(errno)));
     2395          SL_IRETURN(SL_ECLOSE, _("sl_close"));
    23942396        }
    23952397    }
Note: See TracChangeset for help on using the changeset viewer.