summaryrefslogtreecommitdiff
path: root/trans/magic.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-03-31 23:21:59 +0000
committerMiles Bader <miles@gnu.org>1995-03-31 23:21:59 +0000
commitecc24ac1bcea4d08a11ebe824d1cd48962a99393 (patch)
treeb258b07ab07e64e3015a42a2298a18f8b6d7bad8 /trans/magic.c
parent8f2d613931c56e11652968db19b8d2fff3062f70 (diff)
Don't deallocate our right to the underlying disk node, so we don't get
garbage collected prematurely. Also move the check for the bootstrap port after the args check, so that users can run it from the shell to get a usage message.
Diffstat (limited to 'trans/magic.c')
-rw-r--r--trans/magic.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/trans/magic.c b/trans/magic.c
index 1bc4fe9a..f55e1bb6 100644
--- a/trans/magic.c
+++ b/trans/magic.c
@@ -37,10 +37,6 @@ main (int argc, char **argv)
error_t err;
mach_port_t bootstrap, control, realnode;
- task_get_bootstrap_port (mach_task_self (), &bootstrap);
- if (bootstrap == MACH_PORT_NULL)
- error(3, 0, "Must be started as a translator");
-
if (argc != 2 || *argv[1] == '-')
{
fprintf(stderr, "Usage: %s MAGIC", program_invocation_name);
@@ -48,6 +44,10 @@ main (int argc, char **argv)
}
magic = argv[1];
+
+ task_get_bootstrap_port (mach_task_self (), &bootstrap);
+ if (bootstrap == MACH_PORT_NULL)
+ error(3, 0, "Must be started as a translator");
/* Reply to our parent */
mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, &control);
@@ -55,8 +55,6 @@ main (int argc, char **argv)
if (err)
error(1, err, "starting translator");
- mach_port_deallocate (mach_task_self (), realnode);
-
/* Launch */
while (1)
{