diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2012-04-02 20:19:29 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2012-04-02 20:19:29 +0400 |
commit | 467e17b9af28a79cf58a8074637bb2c926765dca (patch) | |
tree | f6441219b54de4435325ae96e20d332edb49bfde /winsup/cygwin/syscalls.cc | |
parent | f7c8c4540a86561fc4cc100c0d752740231d7960 (diff) |
* fhandler.h (fhandler_base::stat_fixup): Rename from
fhandler_base::set_ino_and_dev.
* syscalls.cc (fhandler_base::stat_fixup): Ditto. Accommodate name
change throughout. Fixup link count of console devices.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r-- | winsup/cygwin/syscalls.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index fce0d28ee..81a1238dd 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1589,7 +1589,7 @@ static struct __stat64 dev_st; static bool dev_st_inited; void -fhandler_base::set_ino_and_dev (struct __stat64 *buf) +fhandler_base::stat_fixup (struct __stat64 *buf) { if (!buf->st_ino) buf->st_ino = get_ino (); @@ -1613,7 +1613,13 @@ fhandler_base::set_ino_and_dev (struct __stat64 *buf) } /* Only set st_rdev if it's a device. */ if (!buf->st_rdev && get_major () != DEV_VIRTFS_MAJOR) - buf->st_rdev = get_device (); + { + buf->st_rdev = get_device (); + /* consX, console, conin, and conout point to the same device. + make sure the link count is correct. */ + if (buf->st_rdev == (dev_t) myself->ctty && iscons_dev (myself->ctty)) + buf->st_nlink = 4; + } } extern "C" int @@ -1629,7 +1635,7 @@ fstat64 (int fd, struct __stat64 *buf) memset (buf, 0, sizeof (struct __stat64)); res = cfd->fstat (buf); if (!res) - cfd->set_ino_and_dev (buf); + cfd->stat_fixup (buf); } syscall_printf ("%R = fstat(%d, %p)", res, fd, buf); @@ -1768,7 +1774,7 @@ stat_worker (path_conv &pc, struct __stat64 *buf) memset (buf, 0, sizeof (*buf)); res = fh->fstat (buf); if (!res) - fh->set_ino_and_dev (buf); + fh->stat_fixup (buf); delete fh; } else |