diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 9a526c507..b14ef4e8f 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +Sun Sep 23 16:55:00 2001 Corinna Vinschen + + * 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 * dtable.cc (dtable::build_fhandler): Initialize unit when using diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 19d259a0a..559582bfd 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);