summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremie Koenig <jk@jk.fr.eu.org>2010-08-23 08:24:43 +0000
committerJeremie Koenig <jk@jk.fr.eu.org>2010-08-30 14:29:52 +0200
commit33bfc249fd692910bb1e3f7a5820d31dfda0f284 (patch)
treecab349630a1781f41ea9a9ba758ee13125151c36
parent25bad336ed7af83bfb78b2a3534fdf223554bfc0 (diff)
Handle errors in main
* main.c (main): Handle errors from argp_parse and root_make_node.
-rw-r--r--main.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/main.c b/main.c
index 35d05c6..a1db475 100644
--- a/main.c
+++ b/main.c
@@ -127,19 +127,24 @@ root_make_node (struct node **np)
int main (int argc, char **argv)
{
mach_port_t bootstrap;
+ error_t err;
opt_clk_tck = sysconf(_SC_CLK_TCK);
opt_stat_mode = 0400;
opt_fake_self = -1;
opt_kernel_pid = 2;
- argp_parse (&argp, argc, argv, 0, 0, 0);
+ err = argp_parse (&argp, argc, argv, 0, 0, 0);
+ if (err)
+ error (1, err, "Could not parse command line");
task_get_bootstrap_port (mach_task_self (), &bootstrap);
if (bootstrap == MACH_PORT_NULL)
error (1, 0, "Must be started as a translator");
netfs_init ();
- root_make_node (&netfs_root_node);
+ err = root_make_node (&netfs_root_node);
+ if (err)
+ error (1, err, "Could not create the root node");
netfs_startup (bootstrap, 0);
for (;;)