From faf7ed89435b12a4a58b2ec0357e124bdc830b45 Mon Sep 17 00:00:00 2001 From: Thomas Bushnell Date: Wed, 20 Aug 1997 19:04:25 +0000 Subject: Wed Aug 20 14:28:00 1997 Thomas Bushnell, n/BSG * dir.c (diskfs_lookup_hard): Cope with error return from diskfs_get_filemap. (diskfs_dirempty): Cope (poorly) with error return from diskfs_get_filemap. * truncate.c (force_delayed_copies): Likewise. * pager.c (diskfs_get_filemap): If pager_create fails, return error to caller. --- ext2fs/dir.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'ext2fs/dir.c') diff --git a/ext2fs/dir.c b/ext2fs/dir.c index a31df4e2..f1ea285c 100644 --- a/ext2fs/dir.c +++ b/ext2fs/dir.c @@ -1,6 +1,6 @@ /* Directory management routines - Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. Converted for ext2fs by Miles Bader @@ -153,6 +153,10 @@ diskfs_lookup_hard (struct node *dp, char *name, enum lookup_type type, /* Map in the directory contents. */ memobj = diskfs_get_filemap (dp, prot); + + if (memobj == MACH_PORT_NULL) + return errno; + buf = 0; /* We allow extra space in case we have to do an EXTEND. */ buflen = round_page (dp->dn_stat.st_size + DIRBLKSIZ); @@ -716,6 +720,10 @@ diskfs_dirempty (struct node *dp, struct protid *cred) int hit = 0; /* Found something in the directory. */ memory_object_t memobj = diskfs_get_filemap (dp, VM_PROT_READ); + if (memobj == MACH_PORT_NULL) + /* XXX should reflect error properly. */ + return 0; + err = vm_map (mach_task_self (), &buf, dp->dn_stat.st_size, 0, 1, memobj, 0, 0, VM_PROT_READ, VM_PROT_READ, 0); mach_port_deallocate (mach_task_self (), memobj); -- cgit v1.2.3