66 lines
1.9 KiB
Plaintext
66 lines
1.9 KiB
Plaintext
2013-10-17 10:30:20 - werner@suse.de
|
|
|
|
Found by debugging with valgrind and environment variable LD_LIBRARY_PATH that
|
|
the mount() system call function from the glibc is used instead of a fs3d_mount()
|
|
function. To avoid this make fs3d_mount() a weak symbol to be overloadable by
|
|
a shared library function and make the stub function return -1 for not configured
|
|
file system type.
|
|
|
|
--- src/lib/libast/misc/fs3d.c
|
|
+++ src/lib/libast/misc/fs3d.c 2013-10-17 10:30:20.000000000 +0000
|
|
@@ -28,6 +28,20 @@
|
|
* only active for non-shared 3d library
|
|
*/
|
|
|
|
+#if defined(__linux__) && defined(__GNUC__)
|
|
+# if defined __USE_ISOC99
|
|
+# define _cat_pragma(exp) _Pragma(#exp)
|
|
+# define _weak_pragma(exp) _cat_pragma(weak name)
|
|
+# else
|
|
+# define _weak_pragma(exp)
|
|
+# endif
|
|
+# define _declare(name,sym) __extension__ extern __typeof__(sym) name
|
|
+# define weak_symbol(sym) _weak_pragma(name) _declare(sym,sym) __attribute__((__weak__))
|
|
+# include <error.h>
|
|
+#else
|
|
+# define weak_symbol(sym)
|
|
+#endif
|
|
+
|
|
#define mount ______mount
|
|
|
|
#include <ast.h>
|
|
@@ -35,6 +49,7 @@
|
|
#undef mount
|
|
|
|
#include <fs3d.h>
|
|
+weak_symbol(fs3d_mount);
|
|
|
|
int
|
|
fs3d(register int op)
|
|
@@ -102,11 +117,18 @@ fs3d(register int op)
|
|
* user code that includes <fs3d.h> will have mount() mapped to fs3d_mount()
|
|
* this restricts the various "standard" mount prototype conflicts to this spot
|
|
* this means that code that includes <fs3d.h> cannot access the real mount
|
|
- * (at least without some additional macro hackery
|
|
+ * (at least without some additional macro hackery)
|
|
*/
|
|
|
|
#undef mount
|
|
-
|
|
+#if defined(__linux__) && defined(__GNUC__)
|
|
+int __attribute__((__noinline__))
|
|
+fs3d_mount(const char* source, char* target, int flags, void* data)
|
|
+{
|
|
+ errno = ENODEV;
|
|
+ return -1;
|
|
+}
|
|
+#else
|
|
extern int mount(const char*, char*, int, void*);
|
|
|
|
int
|
|
@@ -114,3 +136,4 @@ fs3d_mount(const char* source, char* tar
|
|
{
|
|
return mount(source, target, flags, data);
|
|
}
|
|
+#endif
|