diff options
| author | Andreas Gruenbacher <agruen@suse.de> | 2005-01-30 12:19:16 +0100 |
|---|---|---|
| committer | Sam Ravnborg <sam@mars.ravnborg.org> | 2005-01-30 12:19:16 +0100 |
| commit | 8d4f441550d933c090d55a02aa7d305d34e5f02e (patch) | |
| tree | c0027200b37363eec0225d6ce30755e758ff4327 /scripts | |
| parent | 2299d0a383144e378c667046d4b5b4a932e1ad1f (diff) | |
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: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/genksyms/genksyms.h | 16 | ||||
| -rw-r--r-- | scripts/mod/modpost.c | 5 | ||||
| -rw-r--r-- | scripts/mod/modpost.h | 4 |
3 files changed, 16 insertions, 9 deletions
diff --git a/scripts/genksyms/genksyms.h b/scripts/genksyms/genksyms.h index 7b711731abf2..f09af47ab281 100644 --- a/scripts/genksyms/genksyms.h +++ b/scripts/genksyms/genksyms.h @@ -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 */ diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 347549c35d6c..9b9f94c915d2 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -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; } diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index eb8815ae209e..7334d839145d 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h @@ -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; |
