From edcd079fa2e831825f93378364f0ecf025e4c876 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sun, 2 Jun 2002 21:41:20 +0000 Subject: 2002-05-29 Roland McGrath * node.c (diskfs_S_file_get_storage_info): Return a null port when the peropen is not open for read/write. Set STORE_READONLY if O_WRITE set. --- tmpfs/node.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tmpfs') diff --git a/tmpfs/node.c b/tmpfs/node.c index 934b6797..4e0d0d53 100644 --- a/tmpfs/node.c +++ b/tmpfs/node.c @@ -559,7 +559,8 @@ diskfs_S_file_get_storage_info (struct protid *cred, assert (*num_ports >= 1); /* mig always gives us some */ *num_ports = 1; *ports_type = MACH_MSG_TYPE_MOVE_SEND; - (*ports)[0] = memobj; + (*ports)[0] + = (cred->po->openstat & O_RDWR) == O_RDWR ? memobj : MACH_PORT_NULL; assert (*num_offsets >= 2); /* mig always gives us some */ *num_offsets = 2; @@ -569,8 +570,7 @@ diskfs_S_file_get_storage_info (struct protid *cred, assert (*num_ints >= 6); /* mig always gives us some */ *num_ints = 6; (*ints)[0] = STORAGE_MEMORY; - (*ints)[1] = (((cred->po->openstat & O_RDWR) == O_READ) - ? STORE_READONLY : 0); + (*ints)[1] = (cred->po->openstat & O_WRITE) ? 0 : STORE_READONLY; (*ints)[2] = 1; /* block size */ (*ints)[3] = 1; /* 1 run in offsets list */ (*ints)[4] = 0; /* name len */ -- cgit v1.2.3