From 0a25564c1c17186951986c996b5ffb2ff3d3f0e3 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 15 May 1999 04:06:51 +0000 Subject: [PATCH] (open_maybe_create): Handle Solaris' failure mode when FILE is a directory. Reported by Vin Shelton. --- src/touch.c | 5 +++-- 1 file 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.