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/truncate.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'ext2fs/truncate.c') diff --git a/ext2fs/truncate.c b/ext2fs/truncate.c index 63cc7340..5dc59638 100644 --- a/ext2fs/truncate.c +++ b/ext2fs/truncate.c @@ -1,6 +1,6 @@ /* File truncation - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. Written by Miles Bader @@ -233,9 +233,15 @@ force_delayed_copies (struct node *node, off_t length) pager_change_attributes (pager, MAY_CACHE, MEMORY_OBJECT_COPY_NONE, 1); obj = diskfs_get_filemap (node, VM_PROT_READ); - poke_pages (obj, round_page (length), round_page (node->allocsize)); - mach_port_deallocate (mach_task_self (), obj); - pager_flush_some (pager, round_page(length), node->allocsize - length, 1); + if (obj != MACH_PORT_NULL) + { + /* XXX should cope with errors from diskfs_get_filemap */ + poke_pages (obj, round_page (length), round_page (node->allocsize)); + mach_port_deallocate (mach_task_self (), obj); + pager_flush_some (pager, round_page(length), + node->allocsize - length, 1); + } + ports_port_deref (pager); } } -- cgit v1.2.3