Files
shadow/debian/patches/403_fix_PATH-MAX_hurd
T
2007-11-20 19:04:43 +00:00

47 lines
1.0 KiB
Plaintext

Goal: Fix FTBFS on Hurd because PATH-MAX is undefined
Fix: #372155
Author: Michael Banck <mbanck@debian.org>
Status wrt upstream: should be forwarded
Index: shadow-4.0.18.1/lib/commonio.c
===================================================================
--- shadow-4.0.18.1/lib/commonio.c.orig 2006-12-07 06:57:01.000000000 +0000
+++ shadow-4.0.18.1/lib/commonio.c 2006-12-07 06:57:40.000000000 +0000
@@ -47,17 +48,31 @@
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;
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;
}
+#ifndef PATH_MAX
+ free (r);
+#endif
}
#endif
res = rename (old, new);