diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 06411906c..5b7318ffc 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +2007-08-24 Corinna Vinschen + + * syscalls.cc (open): Don't follow symlinks if O_EXCL is given. + 2007-08-23 Corinna Vinschen * ntdll.h (STATUS_NO_SUCH_FILE): Define. diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 8afa025b0..f3fa10d26 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -889,8 +889,9 @@ open (const char *unix_path, int flags, ...) if (fd >= 0) { - if (!(fh = build_fh_name (unix_path, NULL, (flags & O_NOFOLLOW) ? - PC_SYM_NOFOLLOW : PC_SYM_FOLLOW, + if (!(fh = build_fh_name (unix_path, NULL, + (flags & (O_NOFOLLOW | O_EXCL)) + ? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW, transparent_exe ? stat_suffixes : NULL))) res = -1; // errno already set else if ((flags & O_NOFOLLOW) && fh->issymlink ())