I tried to compile user-union on ubuntu-16.04
and got a lot of errors like this:
user-union.c:325:15: error: redefinition of ‘strcpy’
C_WRP(char , strcpy, (char s1, const char *s2), (s1, s2))
^
user-union.c:281:52: note: in definition of macro ‘C_WRP’
inline attribute((visibility("hidden"))) RTYPE SYM DEF_ARGS \
^
In file included from /usr/include/features.h:367:0,
from /usr/include/stdio.h:27,
from user-union.c:127:
/usr/include/x86_64-linux-gnu/bits/string3.h:108:1: note: previous definition of ‘strcpy’ was here
NTH (strcpy (char *restrict dest, const char *restrict __src))
Seems like glibc changed the definitions of all functions,
so redefining them is now more difficult.
Additionally there are warnings:
user-union.c:374:9: warning: ‘wrp_vfprintf’ is static but used in inline function ‘fprintf’ which is not static
ret = wrp_vfprintf(stream, format, ap);
These are probably easy to fix.
Good point, thanks for the report.
I suspect there's a gcc/clang option to address this.
Function redefinitions? Perhaps not
when the prototypes are different.
And since glibc added "restrict" and
other things, gcc treats them as different.
But I've found this is only related to the
private namespace stuff.
Perhaps it have to be re-done with the
linker magic (like --wrap option)
Btw, please take a look at this similar project:
https://raw.githubusercontent.com/mikix/deb2snap/master/src/preload.c
Hello David, please pull the fix from here:
https://github.com/stsp/user-union/commits/master