Don't hold back, tell us how you really feel when dlopen() fails.

This commit is contained in:
bad 2013-12-16 23:27:33 +00:00
parent 5588522013
commit a88c18e5e2

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_allserver.c,v 1.28 2013/11/13 17:47:27 pooka Exp $ */ /* $NetBSD: rump_allserver.c,v 1.29 2013/12/16 23:27:33 bad Exp $ */
/*- /*-
* Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved. * Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved.
@ -28,7 +28,7 @@
#include <rump/rumpuser_port.h> #include <rump/rumpuser_port.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: rump_allserver.c,v 1.28 2013/11/13 17:47:27 pooka Exp $"); __RCSID("$NetBSD: rump_allserver.c,v 1.29 2013/12/16 23:27:33 bad Exp $");
#endif /* !lint */ #endif /* !lint */
#include <sys/types.h> #include <sys/types.h>
@ -65,7 +65,11 @@ __dead static void
die(int sflag, int error, const char *reason) die(int sflag, int error, const char *reason)
{ {
fprintf(stderr, "%s: %s", reason, strerror(error)); if (reason != NULL)
fputs(reason, stderr);
if (error > 0)
fprintf(stderr, ": %s", strerror(error));
fputc('\n', stderr);
if (!sflag) if (!sflag)
rump_daemonize_done(error); rump_daemonize_done(error);
exit(1); exit(1);
@ -295,7 +299,8 @@ main(int argc, char *argv[])
snprintf(pb, sizeof(pb), "lib%s.so", optarg); snprintf(pb, sizeof(pb), "lib%s.so", optarg);
if (dlopen(pb, RTLD_LAZY|RTLD_GLOBAL) == NULL) { if (dlopen(pb, RTLD_LAZY|RTLD_GLOBAL) == NULL) {
die(1, 0, "dlopen lib"); fprintf(stderr, "dlopen: %s", dlerror());
die(1, 0, NULL);
} }
} }
break; break;