From: Antonio Huete Jimenez Date: Thu, 2 Sep 2010 05:19:01 +0000 (+0200) Subject: truss - Take care of a couple segfaults. X-Git-Tag: v2.9.0~301^2~1 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/6abace5c51c9dee80c48e05834adb87ae6a89230 truss - Take care of a couple segfaults. Reported-by: Johannes Hofmann DragonFly-bug: --- diff --git a/usr.bin/truss/i386-fbsd.c b/usr.bin/truss/i386-fbsd.c index e070779269..c89e8772ac 100644 --- a/usr.bin/truss/i386-fbsd.c +++ b/usr.bin/truss/i386-fbsd.c @@ -170,7 +170,7 @@ i386_syscall_entry(int pid, int nargs) { if (read(Procfd, fsc.args, nargs * sizeof(unsigned long)) == -1) return; - sc = get_syscall(fsc.name); + sc = fsc.name ? get_syscall(fsc.name) : NULL; if (sc) { fsc.nargs = sc->nargs; } else { @@ -226,7 +226,8 @@ i386_syscall_entry(int pid, int nargs) { * parameter? */ - if (!strcmp(fsc.name, "execve") || !strcmp(fsc.name, "exit")) { + if (fsc.name != NULL && + (!strcmp(fsc.name, "execve") || !strcmp(fsc.name, "exit"))) { print_syscall(outfile, fsc.name, fsc.nargs, fsc.s_args); } @@ -249,6 +250,9 @@ i386_syscall_exit(int pid, int syscall_num __unused) { int errorp; struct syscall *sc; + if (fsc.name == NULL) + return; + if (fd == -1 || pid != cpid) { asprintf(&buf, "%s/%d/regs", procfs_path, pid); if (buf == NULL)