summaryrefslogtreecommitdiff
path: root/libdiskfs/io-map.c
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1997-08-20 18:53:58 +0000
committerThomas Bushnell <thomas@gnu.org>1997-08-20 18:53:58 +0000
commit3847623f7fdbfc66d6ec992ab6faa793fae51b71 (patch)
tree02be11c3a4bc6bc13e5e6c277d6dbbfadfbf1464 /libdiskfs/io-map.c
parente4737b12ffb5bbbd34bb4e6281b8b48e3725161d (diff)
Wed Aug 20 14:03:41 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* diskfs.h: Doc fix. * io-map.c (diskfs_S_io_map): Cope with error return from diskfs_get_filemap. * rdwr-internal.c (_diskfs_rdwr_internal): Likewise.
Diffstat (limited to 'libdiskfs/io-map.c')
-rw-r--r--libdiskfs/io-map.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libdiskfs/io-map.c b/libdiskfs/io-map.c
index c9e897c6..6268f2c5 100644
--- a/libdiskfs/io-map.c
+++ b/libdiskfs/io-map.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994 Free Software Foundation
+ Copyright (C) 1994, 1997 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -44,13 +44,19 @@ diskfs_S_io_map (struct protid *cred,
{
case O_READ | O_WRITE:
*wrobj = *rdobj = diskfs_get_filemap (node, VM_PROT_READ |VM_PROT_WRITE);
+ if (*wrobj == MACH_PORT_NULL)
+ goto error;
mach_port_mod_refs (mach_task_self (), *rdobj, MACH_PORT_RIGHT_SEND, 1);
break;
case O_READ:
*rdobj = diskfs_get_filemap (node, VM_PROT_READ);
+ if (*rdobj == MACH_PORT_NULL)
+ goto error;
break;
case O_WRITE:
*wrobj = diskfs_get_filemap (node, VM_PROT_WRITE);
+ if (*wrobj == MACH_PORT_NULL)
+ goto error;
break;
}
mutex_unlock (&node->lock);
@@ -59,4 +65,9 @@ diskfs_S_io_map (struct protid *cred,
*wrtype = MACH_MSG_TYPE_MOVE_SEND;
return 0;
+
+error:
+ mutex_unlock (&node->lock);
+ return errno;
}
+