Bug#372155: [Pkg-shadow-devel] Bug#372155: shadow: FTBFS on
hurd-i386: PATH_MAX issue
Michael Banck
mbanck at debian.org
Fri Jun 9 14:24:06 UTC 2006
On Thu, Jun 08, 2006 at 11:23:45PM +0300, Alexander Gattin wrote:
> Hey, I don't see the "char *resolved_path" pointer
> being freed anywhere afterwards...
Right, sorry. Here is a better version.
Michael
--
Michael Banck
Debian Developer
mbanck at debian.org
http://www.advogato.org/person/mbanck/diary.html
-------------- next part --------------
--- lib/commonio.c.orig 2006-06-08 15:12:21.000000000 +0200
+++ lib/commonio.c 2006-06-09 16:14:10.000000000 +0200
@@ -47,20 +47,34 @@
int lrename (const char *old, const char *new)
{
+#ifdef PATH_MAX
char resolved_path[PATH_MAX];
+#endif
+ char *r;
int res;
#if defined(S_ISLNK)
struct stat sb = { 0 };
if (lstat (new, &sb) == 0 && S_ISLNK (sb.st_mode)) {
- if (realpath (new, resolved_path) == NULL) {
+#ifndef PATH_MAX
+ r = realpath (new, NULL);
+#else
+ r = realpath (new, resolved_path);
+#endif
+ if (r == NULL) {
+#ifndef PATH_MAX
+ free (r);
+#endif
perror ("realpath in lrename()");
} else {
- new = resolved_path;
+ new = r;
}
}
#endif
res = rename (old, new);
+#ifndef PATH_MAX
+ free (r);
+#endif
return res;
}
More information about the Pkg-shadow-devel
mailing list