Possible sigsegv fix on NetBSD

This commit is contained in:
Michiel Broek 2005-09-02 19:42:20 +00:00
parent 8214c98287
commit c080c5e1e4

View File

@ -239,6 +239,7 @@ int main(int argc, char *argv[])
/* /*
* Systems that use sysctl to get process information * Systems that use sysctl to get process information
*/ */
printf("using sysctl\n");
mib[0] = CTL_KERN; mib[0] = CTL_KERN;
mib[1] = KERN_PROC_ARGS; mib[1] = KERN_PROC_ARGS;
mib[2] = ppid; mib[2] = ppid;
@ -247,18 +248,24 @@ int main(int argc, char *argv[])
fprintf(stderr, "mbuseradd: no memory\n"); fprintf(stderr, "mbuseradd: no memory\n");
exit(1); exit(1);
} }
printf("will call\n");
if (sysctl(mib, 4, s, &siz, NULL, 0) == -1) { if (sysctl(mib, 4, s, &siz, NULL, 0) == -1) {
perror(""); perror("");
fprintf(stderr, "mbuseradd: sysctl call failed\n"); fprintf(stderr, "mbuseradd: sysctl call failed\n");
exit(1); exit(1);
} }
printf("done\n");
buf[0] = '\0'; buf[0] = '\0';
for (p = s; *p != NULL; p++) { printf("%s\n", (char *)s);
if (p != s) // for (p = s; *p != NULL; p++) {
strlcat(buf, " ", sizeof(buf)); // if (p != s)
strlcat(buf, *p, sizeof(buf)); // strlcat(buf, " ", sizeof(buf));
} // strlcat(buf, *p, sizeof(buf));
parent = xstrcpy(buf); // }
parent = xstrcpy((char *)s);
printf("almost done\n");
// parent = xstrcpy(buf);
printf("%s\n", parent);
#else #else
/* /*
* Systems with /proc filesystem like Linux, FreeBSD * Systems with /proc filesystem like Linux, FreeBSD