Bug 8308 - tar 1.13.16: fd leak because of opendir without closedir
tar 1.13.16: fd leak because of opendir without closedir
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: tar (Show other bugs)
6.1
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-01-09 11:25 EST by Jonathan Kamens
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-01-09 13:12:02 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jonathan Kamens 2000-01-09 11:25:58 EST
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 13:12:59 EST
Thanks, fixed in 1.13.17-1

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