Changeset 491 for trunk/src/sh_dbIO.c


Ignore:
Timestamp:
Oct 31, 2015, 10:36:55 PM (9 years ago)
Author:
katerina
Message:

Fix for ticket #389 (libwrap) and #390 (update on FreeBSD).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_dbIO.c

    r483 r491  
    156156{
    157157  FILE * fdp;
    158 
     158 
    159159  SL_ENTER(_("sh_dbIO_setdataent_old"));
    160160
     
    163163  if (0 != seek_sof(fdp, line, size, file))
    164164    SL_RETURN( SL_EREAD, _("sh_dbIO_setdataent_old"));
     165
     166  lseek(fileno(fdp), ftello(fdp), SEEK_SET);
     167
    165168  if (0 != ftruncate(fileno(fdp), ftello(fdp)))
    166169    {
     
    406409       _("There is a record with a bad version number in the file signature database: %s\n"),
    407410       (NULL == filepath) ? _("(null)") : filepath);
    408   sh_error_handle((-1), FIL__, __LINE__, 0, MSG_E_SUBGPATH,
     411  sh_error_handle((-1), file, line, 0, MSG_E_SUBGPATH,
    409412                  _("Record with bad version number in file signature database"),
    410413                  _("sh_dbIO_getdataent"),
     
    13311334  if (pushdata_stdout == S_FALSE)
    13321335    {
    1333       sl_write           (fd,        p, sizeof(sh_filestore_t));
    1334       sl_write_line_fast (fd, fullpath, sl_strlen(fullpath));
    1335       sl_write_line_fast (fd,    lpath, sl_strlen(lpath));
     1336      if (SL_ENONE != sl_write (fd,        p, sizeof(sh_filestore_t)))
     1337        {
     1338          char * tmp = sh_util_safe_name(fullpath);
     1339          sh_error_handle((-1), FIL__, __LINE__, 0, MSG_E_SUBGPATH,
     1340                          _("Failed to write record to baseline database"),
     1341                          _("write_record"),
     1342                          tmp);
     1343          SH_FREE(tmp);
     1344          aud_exit(FIL__, __LINE__,  EXIT_FAILURE );
     1345        }
     1346      if (SL_ENONE != sl_write_line_fast (fd, fullpath, sl_strlen(fullpath)))
     1347        {
     1348          char * tmp = sh_util_safe_name(fullpath);
     1349          sh_error_handle((-1), FIL__, __LINE__, 0, MSG_E_SUBGPATH,
     1350                          _("Failed to write path to baseline database"),
     1351                          _("write_record"),
     1352                          tmp);
     1353          SH_FREE(tmp);
     1354          aud_exit(FIL__, __LINE__,  EXIT_FAILURE );
     1355        }
     1356      if (SL_ENONE != sl_write_line_fast (fd,    lpath, sl_strlen(lpath)))
     1357        {
     1358          char * tmp = sh_util_safe_name(fullpath);
     1359          sh_error_handle((-1), FIL__, __LINE__, 0, MSG_E_SUBGPATH,
     1360                          _("Failed to write lpath to baseline database"),
     1361                          _("write_record"),
     1362                          tmp);
     1363          SH_FREE(tmp);
     1364          aud_exit(FIL__, __LINE__,  EXIT_FAILURE );
     1365        }
    13361366      if (attr_string)
    13371367        sl_write_line_fast (fd, attr_string, sl_strlen(attr_string));
Note: See TracChangeset for help on using the changeset viewer.