1 --- setprogname.c.orig 2008-01-31 02:47:06.000000000 -0800
2 +++ setprogname.c 2008-01-31 03:07:50.000000000 -0800
7 +#include <sys/param.h>
8 +#include <sys/sysctl.h>
9 +#include <crt_externs.h>
10 +#define __progname (*_NSGetProgname())
12 #include "libc_private.h"
15 setprogname(const char *progname)
19 + char buf[2*MAXCOMLEN+1];
22 p = strrchr(progname, '/');
25 + __progname = (char *)(p + 1);
27 - __progname = progname;
28 + __progname = (char *)(p = progname);
30 + strlcpy(&buf[0], (char *)(p), sizeof(buf));
33 + mib[1] = KERN_PROCNAME;
35 + /* ignore errors as this is not a hard error */
36 + sysctl(mib, 2, NULL, NULL, &buf[0], strlen(buf));