diff options
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r-- | winsup/cygwin/syscalls.cc | 18 |
1 files changed, 11 insertions, 7 deletions
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); |