diff options
author | Michael I. Bushnell <mib@gnu.org> | 1995-03-31 17:25:49 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1995-03-31 17:25:49 +0000 |
commit | 3fbfd55e3989af37af9aeb073455abee32a1b885 (patch) | |
tree | 1f4fac9401b775881aa8e5c40fcc244ceb482281 | |
parent | 9a33b6ca7136cd3c9860794dabd57f28e4861798 (diff) |
(diskfs_S_file_set_translator): Only destroy existing active
translator if ACTIVE_FLAGS will change it. If the existing active
translator is provided then don't do anything.
-rw-r--r-- | libdiskfs/file-set-trans.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/libdiskfs/file-set-trans.c b/libdiskfs/file-set-trans.c index a237d711..f7de8254 100644 --- a/libdiskfs/file-set-trans.c +++ b/libdiskfs/file-set-trans.c @@ -1,5 +1,5 @@ /* libdiskfs implementation of fs.defs: file_set_translator - Copyright (C) 1992, 1993, 1994 Free Software Foundation + Copyright (C) 1992, 1993, 1994, 1995 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 @@ -71,17 +71,19 @@ diskfs_S_file_set_translator (struct protid *cred, return EBUSY; } - /* Kill existing active translator */ - if (np->translator.control != MACH_PORT_NULL) - diskfs_destroy_translator (np, killtrans_flags); - if (active_flags & FS_TRANS_SET) { + if (np->translator.control != MACH_PORT_NULL + && np->translator.control != active) + diskfs_destroy_translator (np, killtrans_flags); + if (active != MACH_PORT_NULL) - fshelp_set_control (&np->translator, active); - else - /* Should have been cleared above. */ - assert (np->translator.control == MACH_PORT_NULL); + { + if (active == np->translator.control) + mach_port_deallocate (mach_task_self (), active); + else + fshelp_set_control (&np->translator, active); + } } mutex_unlock (&np->translator.lock); |