summaryrefslogtreecommitdiff
path: root/libdiskfs/file-reparent.c
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2002-03-26 14:59:52 +0000
committerNeal H. Walfield <neal@gnu.org>2002-03-26 14:59:52 +0000
commit22702db6dab56e36c86d91fbf5f2f469fad99f2c (patch)
tree2e887617a1cac327c98cf9329bcf10e0ba1d2b9e /libdiskfs/file-reparent.c
parent5c086e129802f8a5705a7b866b877c37cb88d29b (diff)
2002-03-25 Neal H Walfield <neal@cs.uml.edu>
* peropen-make.c (diskfs_make_peropen): Instead of returning the peropen, return as error_t and return the peropen in the new parameter *PPO. * diskfs.h (diskfs_make_peropen): Change declaration to reflect new semantics. * boot-start.c (diskfs_start_bootstrap): Check the return value of diskfs_make_peropen using the new semantics. (diskfs_S_exec_startup_get_info): Likewise. (diskfs_execboot_fsys_startup): Likewise. (diskfs_S_fsys_init): Likewise. * dir-lookup.c (diskfs_S_dir_lookup): Likewise. * dir-mkfile.c (diskfs_S_dir_mkfile): Likewise. * file-exec.c (diskfs_S_file_exec): Likewise. * file-reparent.c (diskfs_S_file_reparent): Likewise. * fsys-getfile.c (diskfs_S_fsys_getfile): Likewise. * fsys-getroot.c (diskfs_S_fsys_getroot): Likewise. * trans-callback.c (_diskfs_translator_callback2_fn): Likewise. * init-startup.c (diskfs_startup_diskfs): Likewise.
Diffstat (limited to 'libdiskfs/file-reparent.c')
-rw-r--r--libdiskfs/file-reparent.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libdiskfs/file-reparent.c b/libdiskfs/file-reparent.c
index d04cd798..e659bcf0 100644
--- a/libdiskfs/file-reparent.c
+++ b/libdiskfs/file-reparent.c
@@ -1,6 +1,6 @@
/* Reparent a file
- Copyright (C) 1997 Free Software Foundation
+ Copyright (C) 1997,2002 Free Software Foundation
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -30,6 +30,7 @@ diskfs_S_file_reparent (struct protid *cred, mach_port_t parent,
error_t err;
struct node *node;
struct protid *new_cred;
+ struct peropen *new_po;
if (! cred)
return EOPNOTSUPP;
@@ -37,9 +38,13 @@ diskfs_S_file_reparent (struct protid *cred, mach_port_t parent,
node = cred->po->np;
mutex_lock (&node->lock);
- err = diskfs_create_protid (diskfs_make_peropen (node, cred->po->openstat,
- cred->po),
- cred->user, &new_cred);
+ err = diskfs_make_peropen (node, cred->po->openstat, cred->po, &new_po);
+ if (! err)
+ {
+ err = diskfs_create_protid (new_po, cred->user, &new_cred);
+ if (err)
+ diskfs_release_peropen (new_po);
+ }
mutex_unlock (&node->lock);
if (! err)