[Glibc-bsd-commits] r1408 - trunk/libbsd/src
Robert Millan
rmh at costa.debian.org
Thu Mar 30 11:14:57 UTC 2006
Author: rmh
Date: 2006-03-30 11:14:56 +0000 (Thu, 30 Mar 2006)
New Revision: 1408
Modified:
trunk/libbsd/src/progname.c
Log:
For some reason, accessing the argv vector directly may cause SIGSEV. Let's copy it to avoid trouble.
Modified: trunk/libbsd/src/progname.c
===================================================================
--- trunk/libbsd/src/progname.c 2006-03-29 18:53:17 UTC (rev 1407)
+++ trunk/libbsd/src/progname.c 2006-03-30 11:14:56 UTC (rev 1408)
@@ -19,9 +19,10 @@
Rejected in glibc (http://sourceware.org/ml/libc-alpha/2006-03/msg00125.html)
*/
-#include <bsd/stdlib.h>
+#include <bsd/stdlib.h> /* progname, strdup */
+#include <string.h> /* free */
-static char *__progname = NULL;
+char *__progname = NULL;
char *
getprogname ()
@@ -32,5 +33,10 @@
void
setprogname (char *new)
{
- __progname = new;
+ /* For some reason, accessing the argv vector directly may cause SIGSEV. Let's copy it to avoid trouble. */
+
+ if (__progname != NULL)
+ free (__progname);
+
+ __progname = strdup (new);
}
More information about the Glibc-bsd-commits
mailing list