summaryrefslogtreecommitdiff
path: root/src/rm.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1995-12-05 23:39:06 +0000
committerJim Meyering <jim@meyering.net>1995-12-05 23:39:06 +0000
commit5c3c1931dd15db4ad0648aade0ad9b9b4b74dece (patch)
tree91700dd5be9253116320da91d2194af2a93e3028 /src/rm.c
parentd75c1aaea11f3eeb3769709a457e1c33dde19a0a (diff)
downloadcoreutils-5c3c1931dd15db4ad0648aade0ad9b9b4b74dece.tar.xz
(rm): Work around SunOS 4 bug whereby lstat doesn't fail
when given a zero-length file name argument. Reported by Mark Calabretta <mcalabre@atnf.csiro.au>.
Diffstat (limited to 'src/rm.c')
-rw-r--r--src/rm.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/rm.c b/src/rm.c
index 7a9503258..319aebfca 100644
--- a/src/rm.c
+++ b/src/rm.c
@@ -211,7 +211,12 @@ rm (void)
return 1;
}
- if (lstat (pathname, &path_stats))
+ if (lstat (pathname, &path_stats)
+ /* The following or-clause is solely for systems like SunOS 4.1.3
+ with (broken) lstat that interpret a zero-length file name
+ argument as something meaningful. For such systems, manually
+ set errno to ENOENT. */
+ || (pathname[0] == '\0' && (errno = ENOENT)))
{
if (errno == ENOENT && ignore_missing_files)
return 0;