Ignore:
Timestamp:
Oct 12, 2009, 10:40:45 AM (15 years ago)
Author:
katerina
Message:

Add code to check for stale file records on close() and fclose(), fix sl_close() to handle open stream (ticket #163).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_log_check.c

    r237 r252  
    108108          if (1 != fwrite(&save_rec, sizeof(struct logfile_record), 1, fd))
    109109            {
    110               (void) fclose(fd);
     110              (void) sl_fclose(FIL__, __LINE__, fd);
    111111              (void) remove(path);
    112112            }
    113113          else
    114114            {
    115               (void) fclose(fd);
     115              (void) sl_fclose(FIL__, __LINE__, fd);
    116116            }
    117117        }
     
    144144                }
    145145            }
    146           (void) fclose(fd);
     146          (void) sl_fclose(FIL__, __LINE__, fd);
    147147        }
    148148      SH_FREE(path);
     
    329329
    330330      if (thisfile->fp)
    331         fclose(thisfile->fp);
     331        sl_fclose(FIL__, __LINE__, thisfile->fp);
    332332      if (thisfile->filename)
    333333        SH_FREE(thisfile->filename);
     
    614614        {
    615615          fgetpos(logfile->fp, &(logfile->offset));
    616           fclose(logfile->fp);
     616          sl_fclose(FIL__, __LINE__, logfile->fp);
    617617          logfile->fp = NULL;
    618618          sh_string_destroy(&s);
     
    690690        {
    691691          fgetpos(logfile->fp, &(logfile->offset));
    692           fclose(logfile->fp);
     692          sl_fclose(FIL__, __LINE__, logfile->fp);
    693693          logfile->fp = NULL;
    694694          sh_string_destroy(&s);
     
    744744            }
    745745          fgetpos(logfile->fp, &(logfile->offset));
    746           fclose(logfile->fp);
     746          sl_fclose(FIL__, __LINE__, logfile->fp);
    747747          logfile->fp = NULL;
    748748          memset(s, '\0', size);
     
    11681168    }
    11691169
    1170   fclose(fp); remove(template);
     1170  sl_fclose(FIL__, __LINE__, fp); remove(template);
    11711171
    11721172
Note: See TracChangeset for help on using the changeset viewer.