Commit 8d4f4415 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Sam Ravnborg

kbuild: Dont include absolute filenames in binaries

The kbuild utilities are compiled with absolute patch names, so paths
starting with $RPM_BUILD_ROOT would end up in the binaries.  To avoid
this, remove all references to __FILE__ (directly and indirectly via
assert()).
Signed-off-by: default avatarAndreas Gruenbacher <agruen@suse.de>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 2299d0a3
......@@ -25,7 +25,6 @@
#define MODUTILS_GENKSYMS_H 1
#include <stdio.h>
#include <assert.h>
enum symbol_type
......@@ -89,8 +88,17 @@ void error_with_pos(const char *, ...);
#define MODUTILS_VERSION "<in-kernel>"
#define xmalloc(size) ({ void *__ptr = malloc(size); assert(__ptr || size == 0); __ptr; })
#define xstrdup(str) ({ char *__str = strdup(str); assert(__str); __str; })
#define xmalloc(size) ({ void *__ptr = malloc(size); \
if(!__ptr && size != 0) { \
fprintf(stderr, "out of memory\n"); \
exit(1); \
} \
__ptr; })
#define xstrdup(str) ({ char *__str = strdup(str); \
if (!__str) { \
fprintf(stderr, "out of memory\n"); \
exit(1); \
} \
__str; })
#endif /* genksyms.h */
......@@ -47,11 +47,10 @@ warn(const char *fmt, ...)
va_end(arglist);
}
void *do_nofail(void *ptr, const char *file, int line, const char *expr)
void *do_nofail(void *ptr, const char *expr)
{
if (!ptr) {
fatal("Memory allocation failure %s line %d: %s.\n",
file, line, expr);
fatal("modpost: Memory allocation failure: %s.\n", expr);
}
return ptr;
}
......
......@@ -53,8 +53,8 @@ static inline void __endian(const void *src, void *dest, unsigned int size)
#endif
#define NOFAIL(ptr) do_nofail((ptr), __FILE__, __LINE__, #ptr)
void *do_nofail(void *ptr, const char *file, int line, const char *expr);
#define NOFAIL(ptr) do_nofail((ptr), #ptr)
void *do_nofail(void *ptr, const char *expr);
struct buffer {
char *p;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment