Ethereal-dev: [ethereal-dev] Capture files not closed

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Mark Burton <markb@xxxxxxxxxx>
Date: Fri, 19 May 2000 13:42:18 +0100
I have noticed that the current CVS ethereal doesn't close the capture
file descriptor when it should so the disk space taken up by the temp
file doesn't get freed until ethereal exits. The enclosed patch should
fix this.

Regards,

Mark

Index: capture.c
===================================================================
RCS file: /cvsroot/ethereal/capture.c,v
retrieving revision 1.102
diff -c -r1.102 capture.c
*** capture.c	2000/05/18 09:05:25	1.102
--- capture.c	2000/05/19 12:31:54
***************
*** 228,233 ****
--- 228,234 ----
        error = errno;
        close(sync_pipe[1]);
        close(sync_pipe[0]);
+       close(cf.save_file_fd);
        unlink(cf.save_file);
        g_free(cf.save_file);
        cf.save_file = NULL;
***************
*** 236,241 ****
--- 237,244 ----
        return;
      }
  
+     close(cf.save_file_fd);
+ 
      /* Parent process - read messages from the child process over the
         sync pipe. */
      close(sync_pipe[1]);
***************
*** 337,342 ****
--- 340,346 ----
    } else {
      /* Not sync mode. */
      capture_succeeded = capture();
+     close(cf.save_file_fd);
      if (quit_after_cap) {
        /* DON'T unlink the save file.  Presumably someone wants it. */
        gtk_exit(0);