summaryrefslogtreecommitdiff
path: root/libc/misc/internals
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/internals')
-rw-r--r--libc/misc/internals/__uClibc_main.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
index 351161593..6c0dab7fe 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -336,12 +336,14 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc,
__uclibc_progname = *argv;
#ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__
- program_invocation_name = *argv;
- program_invocation_short_name = strrchr(*argv, '/');
- if (program_invocation_short_name != NULL)
- ++program_invocation_short_name;
- else
- program_invocation_short_name = program_invocation_name;
+ if (*argv != NULL) {
+ program_invocation_name = *argv;
+ program_invocation_short_name = strrchr(*argv, '/');
+ if (program_invocation_short_name != NULL)
+ ++program_invocation_short_name;
+ else
+ program_invocation_short_name = program_invocation_name;
+ }
#endif
#ifdef __UCLIBC_CTOR_DTOR__