This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Handle symlink to directory in ldconfig.


On Wed, 23 Jun 2004 00:26:48 -0700, H. J. Lu wrote...
> 
> Here is a patch.
> 
> 
> H.J.

It works for me. However, the following change is needed in order to avoid leak.

--- ldconfig.c-hjl	2004-06-23 20:04:23.000000000 +0900
+++ ldconfig.c	2004-06-23 20:07:11.000000000 +0900
@@ -364,15 +364,20 @@
   else
     path = entry->path;
 
-  if (stat64 (path, &stat_buf))
+  if (path == NULL || stat64 (path, &stat_buf))
     {
       if (opt_verbose)
 	error (0, errno, _("Can't stat %s"), entry->path);
       free (entry->path);
       free (entry);
+      if (opt_chroot && path)
+	free (path);
       return;
     }
 
+  if (opt_chroot)
+    free (path);
+
   entry->ino = stat_buf.st_ino;
   entry->dev = stat_buf.st_dev;
 

----
Hideki IWAMOTO  h-iwamoto@kit.hi-ho.ne.jp


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]