* 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.
This commit is contained in:
parent
db55f91dc0
commit
52792a770d
winsup/cygwin
@ -1,3 +1,11 @@
|
|||||||
|
2005-12-22 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2005-12-22 Christopher Faylor <cgf@timesys.com>
|
2005-12-22 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
* pinfo.cc (winpids::add): Increment nelem when winpid is true since we
|
* pinfo.cc (winpids::add): Increment nelem when winpid is true since we
|
||||||
|
@ -363,6 +363,7 @@ class fhandler_base
|
|||||||
virtual bool is_slow () {return 0;}
|
virtual bool is_slow () {return 0;}
|
||||||
bool is_auto_device () {return isdevice () && !dev ().isfs ();}
|
bool is_auto_device () {return isdevice () && !dev ().isfs ();}
|
||||||
bool is_fs_special () {return pc.is_fs_special ();}
|
bool is_fs_special () {return pc.is_fs_special ();}
|
||||||
|
bool issymlink () {return pc.issymlink ();}
|
||||||
bool device_access_denied (int) __attribute__ ((regparm (2)));
|
bool device_access_denied (int) __attribute__ ((regparm (2)));
|
||||||
int fhaccess (int flags) __attribute__ ((regparm (2)));
|
int fhaccess (int flags) __attribute__ ((regparm (2)));
|
||||||
friend class fhandler_fifo;
|
friend class fhandler_fifo;
|
||||||
|
@ -283,12 +283,13 @@ details. */
|
|||||||
147: Eliminate problematic d_ino from dirent structure. unsetenv now returns
|
147: Eliminate problematic d_ino from dirent structure. unsetenv now returns
|
||||||
int, as per linux.
|
int, as per linux.
|
||||||
148: Add open(2) flags O_SYNC, O_RSYNC, O_DSYNC and O_DIRECT.
|
148: Add open(2) flags O_SYNC, O_RSYNC, O_DSYNC and O_DIRECT.
|
||||||
|
149: Add open(2) flag O_NOFOLLOW.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
|
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
|
||||||
|
|
||||||
#define CYGWIN_VERSION_API_MAJOR 0
|
#define CYGWIN_VERSION_API_MAJOR 0
|
||||||
#define CYGWIN_VERSION_API_MINOR 148
|
#define CYGWIN_VERSION_API_MINOR 149
|
||||||
|
|
||||||
/* There is also a compatibity version number associated with the
|
/* There is also a compatibity version number associated with the
|
||||||
shared memory regions. It is incremented when incompatible
|
shared memory regions. It is incremented when incompatible
|
||||||
|
@ -16,8 +16,10 @@ details. */
|
|||||||
|
|
||||||
/* sys/fcntl defines values up to 0x40000 (O_NOINHERIT). */
|
/* sys/fcntl defines values up to 0x40000 (O_NOINHERIT). */
|
||||||
#define _FDIRECT 0x80000
|
#define _FDIRECT 0x80000
|
||||||
|
#define _FNOFOLLOW 0x100000
|
||||||
|
|
||||||
#define O_DIRECT _FDIRECT
|
#define O_DIRECT _FDIRECT
|
||||||
|
#define O_NOFOLLOW _FNOFOLLOW
|
||||||
#define O_DSYNC _FSYNC
|
#define O_DSYNC _FSYNC
|
||||||
#define O_RSYNC _FSYNC
|
#define O_RSYNC _FSYNC
|
||||||
|
|
||||||
|
@ -597,8 +597,15 @@ open (const char *unix_path, int flags, ...)
|
|||||||
|
|
||||||
if (fd >= 0)
|
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
|
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 ())
|
else if (((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) && fh->exists ())
|
||||||
{
|
{
|
||||||
delete fh;
|
delete fh;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user