From: Jim Meyering Date: Sat, 15 May 1999 04:06:51 +0000 (+0000) Subject: (open_maybe_create): Handle Solaris' failure mode when X-Git-Tag: TEXTUTILS-1_22l~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0a25564c1c17186951986c996b5ffb2ff3d3f0e3;p=thirdparty%2Fcoreutils.git (open_maybe_create): Handle Solaris' failure mode when FILE is a directory. Reported by Vin Shelton. --- diff --git a/src/touch.c b/src/touch.c index 26f3141fb5..c3f76917a6 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.