summaryrefslogtreecommitdiff
path: root/src/ls.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-09-01 09:58:04 +0000
committerJim Meyering <jim@meyering.net>2001-09-01 09:58:04 +0000
commitfa207c29421b12319b78f8b288aae87e1c87efd9 (patch)
tree091aa8025b1978190ebecb28f6c204b21e4aeef2 /src/ls.c
parent9e2ed8d97aab27e3ff42119effdfd65f00d6134c (diff)
downloadcoreutils-fa207c29421b12319b78f8b288aae87e1c87efd9.tar.xz
Include "xreadlink.h".
(get_link_name): Don't use PATH_MAX. Rewrite to use xreadlink.
Diffstat (limited to 'src/ls.c')
-rw-r--r--src/ls.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/src/ls.c b/src/ls.c
index 6033231a6..aeaf4c7b9 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -120,6 +120,7 @@ int wcwidth ();
#include "strverscmp.h"
#include "xstrtol.h"
#include "gtod.h"
+#include "xreadlink.h"
/* Use access control lists only under all the following conditions.
Some systems (OSF4, Irix5, Irix6) have the acl function, but not
@@ -2137,23 +2138,9 @@ gobble_file (const char *name, enum filetype type, int explicit_arg,
static void
get_link_name (const char *filename, struct fileinfo *f)
{
- char *linkbuf;
- register ssize_t linksize;
+ size_t link_val_len;
- linkbuf = (char *) alloca (PATH_MAX + 2);
- /* Some automounters give incorrect st_size for mount points.
- I can't think of a good workaround for it, though. */
- linksize = readlink (filename, linkbuf, PATH_MAX + 1);
- if (linksize < 0)
- {
- error (0, errno, "%s", quotearg_colon (filename));
- exit_status = 1;
- }
- else
- {
- linkbuf[linksize] = '\0';
- f->linkname = xstrdup (linkbuf);
- }
+ f->linkname = xreadlink (filename, &link_val_len);
}
/* If `linkname' is a relative path and `path' contains one or more