summaryrefslogtreecommitdiff
path: root/ext2fs/truncate.c
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1997-08-20 19:04:25 +0000
committerThomas Bushnell <thomas@gnu.org>1997-08-20 19:04:25 +0000
commitfaf7ed89435b12a4a58b2ec0357e124bdc830b45 (patch)
treedbf598eda93785e5d27abe691b98a8eb4a61fba3 /ext2fs/truncate.c
parent3fe6d879dd6efb066188a07e06d9db10659e7e8f (diff)
Wed Aug 20 14:28:00 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* 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.
Diffstat (limited to 'ext2fs/truncate.c')
-rw-r--r--ext2fs/truncate.c14
1 files changed, 10 insertions, 4 deletions
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 <miles@gnu.ai.mit.edu>
@@ -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);
}
}