+2009-12-06 Bruno Haible <bruno@clisp.org>
+
+ * lib/progname.c: Include stdio.h, stdlib.h.
+ (set_program_name): Reject a NULL argument.
+
2009-12-05 Eric Blake <ebb9@byu.net>
pipe2-safer: new module
#include "progname.h"
#include <errno.h> /* get program_invocation_name declaration */
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
const char *slash;
const char *base;
+ /* Sanity check. POSIX requires the invoking process to pass a non-NULL
+ argv[0]. */
+ if (argv0 == NULL)
+ {
+ /* It's a bug in the invoking program. Help diagnosing it. */
+ fputs ("A NULL argv[0] was passed through an exec system call.\n",
+ stderr);
+ abort ();
+ }
+
slash = strrchr (argv0, '/');
base = (slash != NULL ? slash + 1 : argv0);
if (base - argv0 >= 7 && strncmp (base - 7, "/.libs/", 7) == 0)