svn commit: trunk/uClibc: extra/Configs include libc/misc/assert l etc...
vapier at uclibc.org
vapier at uclibc.org
Wed Jan 4 00:46:32 UTC 2006
Author: vapier
Date: 2006-01-03 16:46:31 -0800 (Tue, 03 Jan 2006)
New Revision: 13067
Log:
tweak __progname handling some more since some [bad] apps actually try and use it
Modified:
trunk/uClibc/extra/Configs/Config.in
trunk/uClibc/include/libc-internal.h
trunk/uClibc/libc/misc/assert/__assert.c
trunk/uClibc/libc/misc/ctype/ctype.c
trunk/uClibc/libc/misc/error/err.c
trunk/uClibc/libc/misc/internals/__uClibc_main.c
trunk/uClibc/libc/sysdeps/linux/common/ssp.c
Changeset:
Modified: trunk/uClibc/extra/Configs/Config.in
===================================================================
--- trunk/uClibc/extra/Configs/Config.in 2006-01-04 00:44:42 UTC (rev 13066)
+++ trunk/uClibc/extra/Configs/Config.in 2006-01-04 00:46:31 UTC (rev 13067)
@@ -460,6 +460,18 @@
If unsure, just answer N.
+config UCLIBC_HAS___PROGNAME
+ bool "Support for __progname"
+ default y
+ help
+ Some packages (like openssh) like to peek into internal libc
+ symbols to make their output a bit more user friendly.
+
+ At startup, __progname is automatically set up based on the
+ value of ARGV[0].
+
+ If unsure, just answer N.
+
config UNIX98PTY_ONLY
bool "Support only Unix 98 PTYs"
default y
Modified: trunk/uClibc/include/libc-internal.h
===================================================================
--- trunk/uClibc/include/libc-internal.h 2006-01-04 00:44:42 UTC (rev 13066)
+++ trunk/uClibc/include/libc-internal.h 2006-01-04 00:46:31 UTC (rev 13067)
@@ -440,6 +440,9 @@
# define __pthread_mutex_unlock(mutex) ((void)0)
# endif
+/* internal access to program name */
+extern const char *__uclibc_progname attribute_hidden;
+
# endif /* IS_IN_libc */
#endif /* __ASSEMBLER__ */
Modified: trunk/uClibc/libc/misc/assert/__assert.c
===================================================================
--- trunk/uClibc/libc/misc/assert/__assert.c 2006-01-04 00:44:42 UTC (rev 13066)
+++ trunk/uClibc/libc/misc/assert/__assert.c 2006-01-04 00:46:31 UTC (rev 13067)
@@ -41,10 +41,6 @@
#define ASSERT_SHOW_PROGNAME 1
-#ifdef ASSERT_SHOW_PROGNAME
-extern const char *__progname;
-#endif
-
static int in_assert; /* bss inits to 0. */
void __assert(const char *assertion, const char * filename,
@@ -55,7 +51,7 @@
fprintf(stderr,
#ifdef ASSERT_SHOW_PROGNAME
- "%s: %s: %d: %s: Assertion `%s' failed.\n", __progname,
+ "%s: %s: %d: %s: Assertion `%s' failed.\n", __uclibc_progname,
#else
"%s: %d: %s: Assertion `%s' failed.\n",
#endif
Modified: trunk/uClibc/libc/misc/ctype/ctype.c
===================================================================
--- trunk/uClibc/libc/misc/ctype/ctype.c 2006-01-04 00:44:42 UTC (rev 13066)
+++ trunk/uClibc/libc/misc/ctype/ctype.c 2006-01-04 00:46:31 UTC (rev 13067)
@@ -156,11 +156,9 @@
#ifdef L___ctype_assert
#ifdef __UCLIBC_HAS_CTYPE_ENFORCED__
-extern const char *__progname;
-
void __isctype_assert(int c, int mask)
{
- fprintf(stderr, "%s: __is*{_l}(%d,%#x {locale})\n", __progname, c, mask);
+ fprintf(stderr, "%s: __is*{_l}(%d,%#x {locale})\n", __uclibc_progname, c, mask);
abort();
}
Modified: trunk/uClibc/libc/misc/error/err.c
===================================================================
--- trunk/uClibc/libc/misc/error/err.c 2006-01-04 00:44:42 UTC (rev 13066)
+++ trunk/uClibc/libc/misc/error/err.c 2006-01-04 00:46:31 UTC (rev 13067)
@@ -19,10 +19,8 @@
#endif
#ifdef __UCLIBC_MJN3_ONLY__
-#warning REMINDER: Need a centralized __progname prototype.
#warning REMINDER: Deal with wide oriented stderr case.
#endif
-extern const char *__progname;
static void vwarn_work(const char *format, va_list args, int showerr)
{
@@ -41,7 +39,7 @@
__STDIO_AUTO_THREADLOCK(stderr);
- fprintf(stderr, fmt, __progname);
+ fprintf(stderr, fmt, __uclibc_progname);
if (format) {
vfprintf(stderr, format, args);
f -= 2; /* At 5 (showerr) or 9. */
Modified: trunk/uClibc/libc/misc/internals/__uClibc_main.c
===================================================================
--- trunk/uClibc/libc/misc/internals/__uClibc_main.c 2006-01-04 00:44:42 UTC (rev 13066)
+++ trunk/uClibc/libc/misc/internals/__uClibc_main.c 2006-01-04 00:46:31 UTC (rev 13067)
@@ -63,13 +63,15 @@
#ifdef __UCLIBC_HAS_THREADS__
extern void weak_function __pthread_initialize_minimal(void);
#endif
+
+attribute_hidden const char *__uclibc_progname = NULL;
+#ifdef __UCLIBC_HAS___PROGNAME__
+strong_alias (__uclibc_progname, __progname)
+#endif
#ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__
-char *program_invocation_name = (char *) "";
-char *program_invocation_short_name = (char *) "";
-hidden_strong_alias (program_invocation_name, __progname_full)
-hidden_strong_alias (program_invocation_short_name, __progname)
-#else
-attribute_hidden const char *__progname = NULL;
+attribute_hidden const char *__progname_full = NULL;
+strong_alias (__uclibc_progname, program_invocation_short_name)
+strong_alias (__progname_full, program_invocation_name)
#endif
/*
@@ -261,16 +263,14 @@
#endif
#ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__
- if (likely(argv && argv[0])) {
- __progname_full = *argv;
- __progname = __strrchr(*argv, '/');
- if (__progname != NULL)
- ++__progname;
- else
- __progname = __progname_full;
- }
+ __progname_full = *argv;
+ __progname = __strrchr(*argv, '/');
+ if (__progname != NULL)
+ ++__progname;
+ else
+ __progname = __progname_full;
#else
- __progname = *argv;
+ __uclibc_progname = *argv;
#endif
#ifdef __UCLIBC_CTOR_DTOR__
Modified: trunk/uClibc/libc/sysdeps/linux/common/ssp.c
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/common/ssp.c 2006-01-04 00:44:42 UTC (rev 13066)
+++ trunk/uClibc/libc/sysdeps/linux/common/ssp.c 2006-01-04 00:46:31 UTC (rev 13067)
@@ -77,12 +77,11 @@
void attribute_noreturn __stack_smash_handler(char func[], int damaged __attribute__ ((unused)));
void attribute_noreturn __stack_smash_handler(char func[], int damaged)
{
- extern char *__progname;
static const char message[] = ": stack smashing attack in function ";
block_signals();
- ssp_write(STDERR_FILENO, __progname, message, func);
+ ssp_write(STDERR_FILENO, __uclibc_progname, message, func);
/* The loop is added only to keep gcc happy. */
while(1)
@@ -91,13 +90,12 @@
void attribute_noreturn __stack_chk_fail(void)
{
- extern char *__progname;
static const char msg1[] = "stack smashing detected: ";
static const char msg3[] = " terminated";
block_signals();
- ssp_write(STDERR_FILENO, msg1, __progname, msg3);
+ ssp_write(STDERR_FILENO, msg1, __uclibc_progname, msg3);
/* The loop is added only to keep gcc happy. */
while(1)
@@ -107,13 +105,12 @@
#if 0
void attribute_noreturn __chk_fail(void)
{
- extern char *__progname;
static const char msg1[] = "buffer overflow detected: ";
static const char msg3[] = " terminated";
block_signals();
- ssp_write(STDERR_FILENO, msg1, __progname, msg3);
+ ssp_write(STDERR_FILENO, msg1, __uclibc_progname, msg3);
/* The loop is added only to keep gcc happy. */
while(1)
More information about the uClibc-cvs
mailing list