[kbuild 5/5] Dont include absolute filenames in binaries

From: Andreas Gruenbacher
Date: Tue Jan 18 2005 - 14:42:12 EST


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@xxxxxxx>

Index: linux-2.6.11-rc1-bk6/scripts/genksyms/genksyms.h
===================================================================
--- linux-2.6.11-rc1-bk6.orig/scripts/genksyms/genksyms.h
+++ linux-2.6.11-rc1-bk6/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 */
Index: linux-2.6.11-rc1-bk6/scripts/mod/modpost.c
===================================================================
--- linux-2.6.11-rc1-bk6.orig/scripts/mod/modpost.c
+++ linux-2.6.11-rc1-bk6/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("Memory allocation failure: %s.\n", expr);
}
return ptr;
}
Index: linux-2.6.11-rc1-bk6/scripts/mod/modpost.h
===================================================================
--- linux-2.6.11-rc1-bk6.orig/scripts/mod/modpost.h
+++ linux-2.6.11-rc1-bk6/scripts/mod/modpost.h
@@ -53,8 +53,8 @@ static inline void __endian(const void *

#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;

--
Andreas Gruenbacher <agruen@xxxxxxx>
SUSE Labs, SUSE LINUX PRODUCTS GMBH

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/