summaryrefslogtreecommitdiff
path: root/pflocal
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2021-04-03 21:26:17 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2021-04-03 21:26:17 +0200
commit5ff1e40ee5fd2262192f7819b6de59d16993c5a2 (patch)
treeabd090b1f33b531f2222167ec14d3ff1e28c2a6a /pflocal
parent65a80c709b4a8c909fa1d7de49e0097611bdc057 (diff)
pflocal: Make io_stat allocate inode id
We may not have io_identity called before io_stat, and programs like diff rely on inode numbers being different for different files. * pflocal/io.c (S_io_stat): Allocate socket id if not already allocated.
Diffstat (limited to 'pflocal')
-rw-r--r--pflocal/io.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/pflocal/io.c b/pflocal/io.c
index 2a6b104c..4c79ec9f 100644
--- a/pflocal/io.c
+++ b/pflocal/io.c
@@ -324,7 +324,7 @@ S_io_stat (struct sock_user *user, struct stat *st)
st->st_fstype = FSTYPE_SOCKET;
st->st_mode = sock->mode;
st->st_fsid = getpid ();
- st->st_ino = sock->id;
+
/* As we try to be clever with large transfers, ask for them. */
st->st_blksize = vm_page_size * 16;
st->st_uid = sock->uid;
@@ -332,6 +332,11 @@ S_io_stat (struct sock_user *user, struct stat *st)
pthread_mutex_lock (&sock->lock); /* Make sure the pipes don't go away... */
+ if (sock->id == MACH_PORT_NULL)
+ mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE,
+ &sock->id);
+ st->st_ino = sock->id;
+
rpipe = sock->read_pipe;
wpipe = sock->write_pipe;