coreutils/coreutils-8.17-ls-rootdir-symlink.patch

22 lines
786 B
Diff
Raw Normal View History

diff -urNp coreutils-8.17-orig/src/ls.c coreutils-8.17/src/ls.c
--- coreutils-8.17-orig/src/ls.c 2012-05-11 20:59:01.467946060 +0200
+++ coreutils-8.17/src/ls.c 2012-05-11 21:00:38.276821883 +0200
@@ -3206,14 +3206,9 @@ make_link_name (char const *name, char const *linkname)
if (IS_ABSOLUTE_FILE_NAME (linkname))
return xstrdup (linkname);
- /* The link is to a relative name. Prepend any leading directory
- in 'name' to the link name. */
- size_t prefix_len = dir_len (name);
- if (prefix_len == 0)
- return xstrdup (linkname);
-
- char *p = xmalloc (prefix_len + 1 + strlen (linkname) + 1);
- stpcpy (stpncpy (p, name, prefix_len + 1), linkname);
+ char *d = dir_name (name);
+ char *p = file_name_concat (d, linkname, NULL);
+ free (d);
return p;
}