From 33bfc249fd692910bb1e3f7a5820d31dfda0f284 Mon Sep 17 00:00:00 2001 From: Jeremie Koenig Date: Mon, 23 Aug 2010 08:24:43 +0000 Subject: Handle errors in main * main.c (main): Handle errors from argp_parse and root_make_node. --- main.c | 9 +++++++-- 1 file 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 (;;) -- cgit v1.2.3