summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_socket.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2016-01-11 19:10:45 +0100
committerCorinna Vinschen <corinna@vinschen.de>2016-01-11 19:10:45 +0100
commit27086d628e814b7b73a5c858ff2d9138c22d5543 (patch)
treec79c20bbe37f94021f431aba7829e4077b737370 /winsup/cygwin/fhandler_socket.cc
parentb4cf3f454d8c2a05d6956fbc1eae3942d2f1730a (diff)
downloadcygnal-27086d628e814b7b73a5c858ff2d9138c22d5543.tar.gz
cygnal-27086d628e814b7b73a5c858ff2d9138c22d5543.tar.bz2
cygnal-27086d628e814b7b73a5c858ff2d9138c22d5543.zip
Fix previous fix for generating unique inode numbers for sockets
* fhandler.h (fhandler_base::get_plain_ino): New inline method. Add comment to explain what it's supposed to be used for. * fhandler_socket.cc (fhandler_socket::get_proc_fd_name): Create filename using inode number. (fhandler_socket::fstat): Generate inode number from filename if ino is not set (that's the case in a stat(2) call). * pipe.cc: Throughout, use get_plain_ino when appropriate. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/fhandler_socket.cc')
-rw-r--r--winsup/cygwin/fhandler_socket.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
index 094cc65e8..7d3efad9b 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -250,7 +250,7 @@ fhandler_socket::~fhandler_socket ()
char *
fhandler_socket::get_proc_fd_name (char *buf)
{
- __small_sprintf (buf, "socket:[%lu]", get_socket ());
+ __small_sprintf (buf, "socket:[%lu]", get_plain_ino ());
return buf;
}
@@ -939,7 +939,9 @@ fhandler_socket::fstat (struct stat *buf)
if (!res)
{
buf->st_dev = FHDEV (DEV_TCP_MAJOR, 0);
- buf->st_ino = (ino_t) get_ino ();
+ if (!(buf->st_ino = get_plain_ino ()))
+ sscanf (get_name (), "/proc/%*d/fd/socket:[%lld]",
+ (long long *) &buf->st_ino);
buf->st_mode = S_IFSOCK | S_IRWXU | S_IRWXG | S_IRWXO;
buf->st_size = 0;
}