diff options
author | Zhaoming Luo <zhmingluo@163.com> | 2024-12-08 12:52:37 +0800 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2024-12-08 14:20:15 +0100 |
commit | 84d0e3c62c20f0628bdd37d7e8b770bf389cf504 (patch) | |
tree | 668791b47a1c4267003b541b30f8cbb35d413db6 | |
parent | 382b7d67aee8bd671a46a33d47eca9f99464cad4 (diff) | |
download | hurd-84d0e3c62c20f0628bdd37d7e8b770bf389cf504.tar.gz hurd-84d0e3c62c20f0628bdd37d7e8b770bf389cf504.tar.bz2 hurd-84d0e3c62c20f0628bdd37d7e8b770bf389cf504.zip |
lwip: Properly handle errors during initialization
Reviewed-by: Sergey Bugaev <bugaevc@gmail.com>
Message-ID: <20241208045237.1607-1-zhmingluo@163.com>
-rw-r--r-- | lwip/main.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lwip/main.c b/lwip/main.c index ff9051db..0d92589f 100644 --- a/lwip/main.c +++ b/lwip/main.c @@ -218,7 +218,7 @@ main (int argc, char **argv) task_get_bootstrap_port (mach_task_self (), &bootstrap); if (bootstrap == MACH_PORT_NULL) - error (-1, 0, "Must be started as a translator"); + error (1, 0, "Must be started as a translator"); /* Create portclass to install on the bootstrap port. */ if (lwip_protid_portclasses[lwip_bootstrap_portclass] != NULL) @@ -228,13 +228,13 @@ main (int argc, char **argv) trivfs_add_protid_port_class (&lwip_protid_portclasses [lwip_bootstrap_portclass]); if (err) - error (1, 0, "error creating control port class"); + error (1, err, "error creating control port class"); err = trivfs_add_control_port_class (&lwip_cntl_portclasses [lwip_bootstrap_portclass]); if (err) - error (1, 0, "error creating control port class"); + error (1, err, "error creating control port class"); /* Reply to our parent */ err = trivfs_startup (bootstrap, 0, @@ -244,9 +244,7 @@ main (int argc, char **argv) lwip_bucket, &lwipcntl); mach_port_deallocate (mach_task_self (), bootstrap); if (err) - { - return (-1); - } + error (1, err, "trivfs_startup failed"); /* Initialize status from underlying node. */ lwip_owner = lwip_group = 0; |