summaryrefslogtreecommitdiff
path: root/src/touch.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-12-02 20:05:33 +0000
committerJim Meyering <jim@meyering.net>2001-12-02 20:05:33 +0000
commit7afc9d18292231719e569fbc89582e3d53d2293a (patch)
treeda4e68dcbb1d4e95e2556e3f391f0262c7abb0a7 /src/touch.c
parent15295aaf8a410c87628c10db09e19b76e59582b6 (diff)
downloadcoreutils-7afc9d18292231719e569fbc89582e3d53d2293a.tar.xz
(touch): Extend the change of 2001-09-15 to work on
systems for which errno is set to EPERM in that case. Thus, e.g., `touch /' by non-root gives a better diagnostic on systems like SunOS4.
Diffstat (limited to 'src/touch.c')
-rw-r--r--src/touch.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/touch.c b/src/touch.c
index a4225f927..3590cb51b 100644
--- a/src/touch.c
+++ b/src/touch.c
@@ -146,8 +146,8 @@ touch (const char *file)
/* Don't save a copy of errno if it's EISDIR, since that would lead
touch to give a bogus diagnostic for e.g., `touch /' (assuming
we don't own / or have write access to it). On Solaris 5.6,
- and probably other systems, it is EINVAL. */
- if (fd == -1 && errno != EISDIR && errno != EINVAL)
+ and probably other systems, it is EINVAL. On SunOS4, it's EPERM. */
+ if (fd == -1 && errno != EISDIR && errno != EINVAL && errno != EPERM)
open_errno = errno;
}