From e4ccf5a138a9c6387ee2e4b8e41d628e0a2cc336 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 7 Feb 2013 12:06:44 -0800 Subject: [PATCH] __progname should be const char*, not char*. Change-Id: I8e846872c30a712fbc05c8da59ffa1cec1be31a4 --- libc/bionic/err.c | 2 +- libc/bionic/libc_init_common.cpp | 4 ++-- libc/bionic/malloc_debug_common.cpp | 2 +- libc/bionic/pthread_debug.cpp | 2 +- libc/unistd/syslog.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libc/bionic/err.c b/libc/bionic/err.c index 535b7e1de..84a3d85c3 100644 --- a/libc/bionic/err.c +++ b/libc/bionic/err.c @@ -34,7 +34,7 @@ #include #include -extern char *__progname; +extern const char* __progname; __noreturn void err(int eval, const char *fmt, ...) diff --git a/libc/bionic/libc_init_common.cpp b/libc/bionic/libc_init_common.cpp index 6b4ae2c90..71acc45a0 100644 --- a/libc/bionic/libc_init_common.cpp +++ b/libc/bionic/libc_init_common.cpp @@ -46,7 +46,7 @@ extern "C" unsigned __get_sp(void); extern "C" int __system_properties_init(void); // Not public, but well-known in the BSDs. -char* __progname; +const char* __progname; // Declared in char** environ; @@ -88,7 +88,7 @@ void __libc_init_common(KernelArgumentBlock& args) { environ = args.envp; errno = 0; __libc_auxv = args.auxv; - __progname = args.argv[0] ? args.argv[0] : const_cast(""); + __progname = args.argv[0] ? args.argv[0] : ""; // Get the main thread from TLS and add it to the thread list. pthread_internal_t* main_thread = __get_thread(); diff --git a/libc/bionic/malloc_debug_common.cpp b/libc/bionic/malloc_debug_common.cpp index 248a2db25..a05a5ef40 100644 --- a/libc/bionic/malloc_debug_common.cpp +++ b/libc/bionic/malloc_debug_common.cpp @@ -256,7 +256,7 @@ static MallocDebug gMallocUse __attribute__((aligned(32))) = { dlmalloc, dlfree, dlcalloc, dlrealloc, dlmemalign }; -extern char* __progname; +extern const char* __progname; /* Handle to shared library where actual memory allocation is implemented. * This library is loaded and memory allocation calls are redirected there diff --git a/libc/bionic/pthread_debug.cpp b/libc/bionic/pthread_debug.cpp index 21eac63b8..f8f0c5953 100644 --- a/libc/bionic/pthread_debug.cpp +++ b/libc/bionic/pthread_debug.cpp @@ -116,7 +116,7 @@ static const char* const kStartBanner = static const char* const kEndBanner = "==============================================================="; -extern char* __progname; +extern const char* __progname; #define STACK_TRACE_DEPTH 16 diff --git a/libc/unistd/syslog.c b/libc/unistd/syslog.c index 3571d5900..78784751f 100644 --- a/libc/unistd/syslog.c +++ b/libc/unistd/syslog.c @@ -46,7 +46,7 @@ static struct syslog_data sdata = SYSLOG_DATA_INIT; -extern char *__progname; /* Program name, from crt0. */ +extern const char *__progname; /* Program name, from crt0. */ static void disconnectlog_r(struct syslog_data *); /* disconnect from syslogd */ static void connectlog_r(struct syslog_data *); /* (re)connect to syslogd */