summaryrefslogtreecommitdiffstats
path: root/sbin/geom
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/geom')
-rw-r--r--sbin/geom/core/geom.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c
index 17a4ad8..3db7cf4 100644
--- a/sbin/geom/core/geom.c
+++ b/sbin/geom/core/geom.c
@@ -471,18 +471,19 @@ load_library(void)
snprintf(path, sizeof(path), "%s/geom_%s.so", library_path(),
class_name);
- dlh = dlopen(path, RTLD_NOW);
- if (dlh == NULL) {
-#if 0
- fprintf(stderr, "Cannot open library %s, but continuing "
- "anyway.\n", path);
-#endif
- /*
- * Even if library cannot be loaded, standard commands are
- * available, so don't panic!
- */
- return;
+ if (access(path, F_OK) == -1) {
+ if (errno == ENOENT) {
+ /*
+ * If we cannot find library, that's ok, standard
+ * commands can still be used.
+ */
+ return;
+ }
+ err(EXIT_FAILURE, "Cannot access library");
}
+ dlh = dlopen(path, RTLD_NOW);
+ if (dlh == NULL)
+ errx(EXIT_FAILURE, "Cannot open library: %s.", dlerror());
lib_version = dlsym(dlh, "lib_version");
if (lib_version == NULL) {
fprintf(stderr, "Cannot find symbol %s: %s.\n", "lib_version",
OpenPOWER on IntegriCloud