Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 8308 - tar 1.13.16: fd leak because of opendir without closedir
Summary: tar 1.13.16: fd leak because of opendir without closedir
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: tar
Version: 6.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-01-09 16:25 UTC by Jonathan Kamens
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-01-09 18:12:02 UTC


Attachments (Terms of Use)

Description Jonathan Kamens 2000-01-09 16:25:58 UTC
There is a file descriptor leak in the 1.13.16 release of tar because of an
opendir in dump_file in create.c which is not followed by a corresponding
closedir.  Here's a fix:

--- create.c.orig	Sun Jan  9 11:27:23 2000
+++ create.c	Sun Jan  9 11:31:47 2000
@@ -1128,14 +1128,19 @@
 	    assign_string (&save_name, 0);
 	  if (atime_preserve_option)
 	    utime (p, &restore_times);
+          if (closedir (directory) != 0)
+            closedir_error (p);
 	  return;
 	}

       /* See if we are about to recurse into a directory, and avoid doing
 	 so if the user wants that we do not descend into directories.  */

-      if (no_recurse_option)
+      if (no_recurse_option) {
+        if (closedir (directory) != 0)
+          closedir_error (p);
 	return;
+      }

       /* See if we are crossing from one file system to another, and
 	 avoid doing so if the user only wants to dump one file system.  */
@@ -1146,6 +1151,8 @@
 	  if (verbose_option)
 	    WARN ((0, 0, _("%s is on a different filesystem; not dumped"),
 		   quote (p)));
+          if (closedir (directory) != 0)
+            closedir_error (p);
 	  return;
 	}

Comment 1 Bernhard Rosenkraenzer 2000-01-09 18:12:59 UTC
Thanks, fixed in 1.13.17-1


Note You need to log in before you can comment on or make changes to this bug.