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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user