summaryrefslogtreecommitdiff
path: root/src/dired.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-05-02 23:53:03 +0000
committerRichard M. Stallman <rms@gnu.org>1994-05-02 23:53:03 +0000
commit67dfc8e75af7e2c50ca037a3c7e15f621d2f16b0 (patch)
tree995487d7503fc0a02d1eea5ff79b9ac755ee6689 /src/dired.c
parent912ce32210e2ea1198e46c35bf2684f50be84a81 (diff)
downloademacs-67dfc8e75af7e2c50ca037a3c7e15f621d2f16b0.tar.gz
(file_name_completion_stat): Use both lstat and stat.
Diffstat (limited to 'src/dired.c')
-rw-r--r--src/dired.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/dired.c b/src/dired.c
index d8b9683514f..42391774db8 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -491,6 +491,7 @@ file_name_completion_stat (dirname, dp, st_addr)
{
int len = NAMLEN (dp);
int pos = XSTRING (dirname)->size;
+ int value;
char *fullname = (char *) alloca (len + pos + 2);
bcopy (XSTRING (dirname)->data, fullname, pos);
@@ -503,7 +504,12 @@ file_name_completion_stat (dirname, dp, st_addr)
fullname[pos + len] = 0;
#ifdef S_IFLNK
- return lstat (fullname, st_addr);
+ /* We want to return success if a link points to a nonexistent file,
+ but we want to return the status for what the link points to,
+ in case it is a directory. */
+ value = lstat (fullname, st_addr);
+ stat (fullname, st_addr);
+ return value;
#else
return stat (fullname, st_addr);
#endif