summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/syscalls.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2005-12-22 16:45:15 +0000
committerCorinna Vinschen <corinna@vinschen.de>2005-12-22 16:45:15 +0000
commit52792a770dd5c40202ea98917b8af384b60da83c (patch)
treee9317162611e0445c04cd46dfddca71a2c752070 /winsup/cygwin/syscalls.cc
parentdb55f91dc081407404559ebe50f126fed048800e (diff)
downloadcygnal-52792a770dd5c40202ea98917b8af384b60da83c.tar.gz
cygnal-52792a770dd5c40202ea98917b8af384b60da83c.tar.bz2
cygnal-52792a770dd5c40202ea98917b8af384b60da83c.zip
* fhandler.h (fhandler_base::issymlink): New method.
* syscalls.cc (open): Handle O_NOFOLLOW flag. * include/fcntl.h (_FNOFOLLOW): New define. (O_NOFOLLOW): Ditto. * include/cygwin/version.h: Bump API minor number.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index cdfce29af..9c938d572 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -597,8 +597,15 @@ open (const char *unix_path, int flags, ...)
if (fd >= 0)
{
- if (!(fh = build_fh_name (unix_path, NULL, PC_SYM_FOLLOW)))
+ if (!(fh = build_fh_name (unix_path, NULL, (flags & O_NOFOLLOW) ?
+ PC_SYM_NOFOLLOW : PC_SYM_FOLLOW)))
res = -1; // errno already set
+ else if ((flags & O_NOFOLLOW) && fh->issymlink ())
+ {
+ delete fh;
+ res = -1;
+ set_errno (ELOOP);
+ }
else if (((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) && fh->exists ())
{
delete fh;