diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2020-12-24 11:38:48 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-12-24 12:06:48 -0800 |
commit | 340dcbd879d050aebcd7081ec5f2208f0e2418b6 (patch) | |
tree | f33d2d247a61d0d7d541c6d4c93fd1bada7eb2db /lib/unlinkat.c | |
parent | 53181ff5e9f8a17348b9465a0d58f6e732d5a03d (diff) | |
download | gnulib-340dcbd879d050aebcd7081ec5f2208f0e2418b6.tar.gz |
stat failing with EOVERFLOW implies existence
* lib/euidaccess.c (euidaccess):
* lib/file-has-acl.c (file_has_acl):
* lib/link.c (link, rpl_link):
* lib/mkdir.c (rpl_mkdir):
* lib/mkfifo.c (rpl_mkfifo):
* lib/mknod.c (rpl_mknod):
* lib/ptsname_r.c (__ptsname_r):
* lib/symlink.c (rpl_symlink):
* lib/symlinkat.c (rpl_symlinkat):
* lib/unlink.c (rpl_unlink):
* lib/unlinkat.c (rpl_unlinkat):
* lib/utime.c (utime):
If stat fails with EOVERFLOW the file exists, so treat it that way
in file-existence tests that do not need struct stat values.
Diffstat (limited to 'lib/unlinkat.c')
-rw-r--r-- | lib/unlinkat.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/unlinkat.c b/lib/unlinkat.c index 442368641a..02ac851eea 100644 --- a/lib/unlinkat.c +++ b/lib/unlinkat.c @@ -59,7 +59,7 @@ rpl_unlinkat (int fd, char const *name, int flag) directory. */ struct stat st; result = lstatat (fd, name, &st); - if (result == 0) + if (result == 0 || errno == EOVERFLOW) { /* Trailing NUL will overwrite the trailing slash. */ char *short_name = malloc (len); @@ -78,6 +78,7 @@ rpl_unlinkat (int fd, char const *name, int flag) return -1; } free (short_name); + result = 0; } } if (!result) |