Changeset 252 for trunk/src/sh_gpg.c


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_gpg.c

    r248 r252  
    8888FILE * pdbgc;
    8989#define PDBG_OPEN    pdbg = fopen(PDGBFILE"main",  "a") 
    90 #define PDBG_CLOSE   fclose (pdbg)
     90#define PDBG_CLOSE   sl_fclose (FIL__, __LINE__, pdbg)
    9191#define PDBG(arg)    fprintf(pdbg,  "PDBG: step %d\n", arg); fflush(pdbg)
    9292#define PDBG_D(arg)  fprintf(pdbg,  "PDBG: %d\n", arg); fflush(pdbg)
     
    9494
    9595#define PDBGC_OPEN   pdbgc = fopen(PDGBFILE"child", "a") 
    96 #define PDBGC_CLOSE  fclose (pdbgc)
     96#define PDBGC_CLOSE  sl_fclose (FIL__, __LINE__, pdbgc)
    9797#define PDBGC(arg)   fprintf(pdbgc, "PDBG: step %d\n", arg); fflush(pdbgc)
    9898#define PDBGC_D(arg) fprintf(pdbgc, "PDBG: %d\n", arg); fflush(pdbgc)
     
    446446  if (source->pid == (pid_t) - 1)
    447447    {
    448       close(pipedes[0]);
    449       close(pipedes[1]);
     448      sl_close_fd(FIL__, __LINE__, pipedes[0]);
     449      sl_close_fd(FIL__, __LINE__, pipedes[1]);
    450450      if (envp[0] != NULL)
    451451        free(envp[0]);
     
    468468      /* close the pipe descriptors
    469469       */
    470       close (pipedes[STDIN_FILENO]);
    471       close (pipedes[STDOUT_FILENO]);
     470      sl_close_fd (FIL__, __LINE__, pipedes[STDIN_FILENO]);
     471      sl_close_fd (FIL__, __LINE__, pipedes[STDOUT_FILENO]);
    472472     
    473473
     
    618618    free(envp[0]);
    619619
    620   close (pipedes[STDOUT_FILENO]);
     620  sl_close_fd (FIL__, __LINE__, pipedes[STDOUT_FILENO]);
    621621  retry_fcntl (FIL__, __LINE__, pipedes[STDIN_FILENO], F_SETFD, FD_CLOEXEC);
    622622  retry_fcntl (FIL__, __LINE__, pipedes[STDIN_FILENO], F_SETFL,  O_NONBLOCK);
     
    627627    {
    628628      aud_kill (FIL__, __LINE__, source->pid, SIGKILL);
    629       close (pipedes[STDOUT_FILENO]);
     629      sl_close_fd (FIL__, __LINE__, pipedes[STDOUT_FILENO]);
    630630      waitpid (source->pid, NULL, 0);
    631631      source->pid = 0;
     
    643643  SL_ENTER(_("sh_gpg_pclose"));
    644644
    645   status = fclose(source->pipe);
     645  status = sl_fclose(FIL__, __LINE__, source->pipe);
    646646  if (status)
    647647    SL_RETURN( (-1), _("sh_gpg_pclose"));
Note: See TracChangeset for help on using the changeset viewer.