summaryrefslogtreecommitdiff
path: root/src/touch.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-05-15 04:06:51 +0000
committerJim Meyering <jim@meyering.net>1999-05-15 04:06:51 +0000
commit0a25564c1c17186951986c996b5ffb2ff3d3f0e3 (patch)
tree9de83b2de299136f47862f1443112155a0e0cac2 /src/touch.c
parent7565800a1155104559b5c02b73afc2e3b2aeda07 (diff)
downloadcoreutils-0a25564c1c17186951986c996b5ffb2ff3d3f0e3.tar.xz
(open_maybe_create): Handle Solaris' failure mode when
FILE is a directory. Reported by Vin Shelton.
Diffstat (limited to 'src/touch.c')
-rw-r--r--src/touch.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/touch.c b/src/touch.c
index 26f3141fb..c3f76917a 100644
--- a/src/touch.c
+++ b/src/touch.c
@@ -121,8 +121,9 @@ open_maybe_create (const char *file, int *file_created)
*file_created = 1;
/* If the open succeeded or if it failed for any reason other
- than the existence of FILE, then we're done. */
- if (fd != -1 || errno != EEXIST)
+ than the existence of FILE, then we're done. Some systems
+ (solaris) set errno to EINVAL when FILE is a directory. */
+ if (fd != -1 || (errno != EEXIST && errno != EINVAL))
break;
/* The first open failed because FILE already exists.