about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/env/__libc_start_main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/env/__libc_start_main.c b/src/env/__libc_start_main.c
index 5c79be28..18afdc1d 100644
--- a/src/env/__libc_start_main.c
+++ b/src/env/__libc_start_main.c
@@ -30,10 +30,10 @@ void __init_libc(char **envp, char *pn)
 	__sysinfo = aux[AT_SYSINFO];
 	libc.page_size = aux[AT_PAGESZ];
 
-	if (pn) {
-		__progname = __progname_full = pn;
-		for (i=0; pn[i]; i++) if (pn[i]=='/') __progname = pn+i+1;
-	}
+	if (!pn) pn = (void*)aux[AT_EXECFN];
+	if (!pn) pn = "";
+	__progname = __progname_full = pn;
+	for (i=0; pn[i]; i++) if (pn[i]=='/') __progname = pn+i+1;
 
 	__init_tls(aux);
 	__init_ssp((void *)aux[AT_RANDOM]);