Backed out d92bf83
authorNikolaus Rath <Nikolaus@rath.org>
Fri, 3 Nov 2017 10:51:06 +0000 (10:51 +0000)
committerNikolaus Rath <Nikolaus@rath.org>
Fri, 3 Nov 2017 10:51:06 +0000 (10:51 +0000)
This change is bogus. fuse_module_factory_t is already a pointer
type. Additionally, if dlsym returns NULL, then you will be
dereferencing it causing a segfault. In my testing, a segfault will
happen even if dlsym returns successfully.

Thanks to Michael Theall for spotting!

lib/fuse.c

index 3a72cb5b5c1dc0389e32e749991ea42588258932..56b863a4cb850360c45b2237a1b7bcb32a014760 100644 (file)
@@ -263,7 +263,7 @@ static int fuse_load_so_module(const char *module)
        }
 
        sprintf(tmp, "fuse_module_%s_factory", module);
-       factory = *((fuse_module_factory_t *) dlsym(so->handle, tmp));
+       *(void**)(&factory) = dlsym(so->handle, tmp);
        if (factory == NULL) {
                fprintf(stderr, "fuse: symbol <%s> not found in module: %s\n",
                        tmp, dlerror());