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:
Corinna Vinschen
2016-01-11 19:10:45 +01:00
parent b4cf3f454d
commit 27086d628e
3 changed files with 12 additions and 8 deletions

View File

@@ -304,6 +304,8 @@ class fhandler_base
const char *get_name () const { return pc.get_posix (); }
const char *get_win32_name () { return pc.get_win32 (); }
virtual dev_t get_dev () { return get_device (); }
/* Use get_plain_ino if the caller needs to avoid hashing if ino is 0. */
ino_t get_plain_ino () { return ino; }
ino_t get_ino () { return ino ?: ino = hash_path_name (0, pc.get_nt_native_path ()); }
int64_t get_unique_id () const { return unique_id; }
/* Returns name used for /proc/<pid>/fd in buf. */