* syscalls.cc (fhandler_base::stat_fixup): Fix inode numbers of

non-device files in virtual fileysystems.
This commit is contained in:
Corinna Vinschen 2012-04-11 08:49:52 +00:00
parent a281df5589
commit e62d782aec
2 changed files with 9 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2012-04-11 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (fhandler_base::stat_fixup): Fix inode numbers of
non-device files in virtual fileysystems.
2012-04-07 Christopher Faylor <me.cygwin2012@cgf.cx> 2012-04-07 Christopher Faylor <me.cygwin2012@cgf.cx>
* dtable.cc (cygwin_attach_handle_to_fd): Defend against NULL return * dtable.cc (cygwin_attach_handle_to_fd): Defend against NULL return

View File

@ -1591,10 +1591,11 @@ static bool dev_st_inited;
void void
fhandler_base::stat_fixup (struct __stat64 *buf) fhandler_base::stat_fixup (struct __stat64 *buf)
{ {
/* Set inode number to device number. This gives us a valid, unique /* For devices, set inode number to device number. This gives us a valid,
inode number and we especially don't have to call hash_path_name. */ unique inode number without having to call hash_path_name. */
if (!buf->st_ino) if (!buf->st_ino)
buf->st_ino = get_device (); buf->st_ino = (get_major () == DEV_VIRTFS_MAJOR) ? get_ino ()
: get_device ();
/* For /dev-based devices, st_dev must be set to the device number of /dev, /* For /dev-based devices, st_dev must be set to the device number of /dev,
not it's own device major/minor numbers. What we do here to speed up not it's own device major/minor numbers. What we do here to speed up
the process is to fetch the device number of /dev only once, liberally the process is to fetch the device number of /dev only once, liberally