diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2001-09-23 15:35:02 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2001-09-23 15:35:02 +0000 |
commit | 4367ec036fabc17ed167b798449537d2a05dda71 (patch) | |
tree | 67e4edde1932b9099af4071f8c5ee067c4fee6a2 /winsup | |
parent | e3fbb5f5ce172603b76e862d493e1dc3935a84b2 (diff) | |
download | newlib-4367ec036fabc17ed167b798449537d2a05dda71.zip newlib-4367ec036fabc17ed167b798449537d2a05dda71.tar.gz newlib-4367ec036fabc17ed167b798449537d2a05dda71.tar.bz2 |
* syscalls.cc (_open): Set name in fhandler object after successful
creation.
(stat_dev): Set device type to block device in FH_FLOPPY case.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 18 |
2 files changed, 17 insertions, 7 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 9a526c5..b14ef4e 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +Sun Sep 23 16:55:00 2001 Corinna Vinschen <corinna@vinschen.de> + + * syscalls.cc (_open): Set name in fhandler object after successful + creation. + (stat_dev): Set device type to block device in FH_FLOPPY case. + Sun Sep 23 11:15:00 2001 Corinna Vinschen <corinna@vinschen.de> * dtable.cc (dtable::build_fhandler): Initialize unit when using diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 19d259a..559582b 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -487,15 +487,19 @@ _open (const char *unix_path, int flags, ...) else { path_conv pc; - if ((fh = cygheap->fdtab.build_fhandler (fd, unix_path, NULL, &pc)) == NULL) + if (!(fh = cygheap->fdtab.build_fhandler (fd, unix_path, NULL, &pc))) res = -1; // errno already set - else if (!fh->open (pc, flags, (mode & 07777) & ~cygheap->umask)) + else { - cygheap->fdtab.release (fd); - res = -1; + fh->set_name (unix_path, pc.get_win32 ()); + if (!fh->open (pc, flags, (mode & 07777) & ~cygheap->umask)) + { + cygheap->fdtab.release (fd); + res = -1; + } + else if ((res = fd) <= 2) + set_std_handle (res); } - else if ((res = fd) <= 2) - set_std_handle (res); } ReleaseResourceLock (LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," open"); } @@ -1043,7 +1047,7 @@ stat_dev (DWORD devn, int unit, unsigned long ino, struct stat *buf) break; } - buf->st_mode |= S_IFCHR; + buf->st_mode |= devn == FH_FLOPPY ? S_IFBLK : S_IFCHR; buf->st_blksize = S_BLKSIZE; buf->st_nlink = 1; buf->st_dev = buf->st_rdev = FHDEVN (devn) << 8 | (unit & 0xff); |