diff options
author | Robert Mustacchi <rm@joyent.com> | 2013-03-01 01:23:33 +0000 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2013-03-01 01:28:10 +0000 |
commit | f27ad3fd8113937ccb955ccecbefe78daf151324 (patch) | |
tree | fed49579494d112bc6ce9049afa3eaf221637fa1 | |
parent | 060c4ebffedd25785f8686f4a0d4098979f2d729 (diff) | |
download | illumos-joyent-f27ad3fd8113937ccb955ccecbefe78daf151324.tar.gz |
OS-1929 pfiles shouldn't try to trace itself
OS-1931 pfiles crashes on processes with no files
-rw-r--r-- | usr/src/cmd/ptools/pfiles/pfiles.c | 9 | ||||
-rw-r--r-- | usr/src/lib/libproc/common/Pfdinfo.c | 5 |
2 files changed, 8 insertions, 6 deletions
diff --git a/usr/src/cmd/ptools/pfiles/pfiles.c b/usr/src/cmd/ptools/pfiles/pfiles.c index a5cefcbdce..a30ea0404d 100644 --- a/usr/src/cmd/ptools/pfiles/pfiles.c +++ b/usr/src/cmd/ptools/pfiles/pfiles.c @@ -23,6 +23,9 @@ * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2012 DEY Storage Systems, Inc. All rights reserved. */ +/* + * Copyright (c) 2013 Joyent, Inc. All Rights reserved. + */ #include <stdio.h> #include <stdlib.h> @@ -180,14 +183,10 @@ main(int argc, char **argv) } else { switch (gret) { case G_SYS: - case G_SELF: proc_unctrl_psinfo(&psinfo); (void) printf("%d:\t%.70s\n", (int)pid, psinfo.pr_psargs); - if (gret == G_SYS) - (void) printf(" [system process]\n"); - else - show_files(NULL); + (void) printf(" [system process]\n"); break; default: (void) fprintf(stderr, "%s: %s: %d\n", diff --git a/usr/src/lib/libproc/common/Pfdinfo.c b/usr/src/lib/libproc/common/Pfdinfo.c index 0d41b5606d..124439773b 100644 --- a/usr/src/lib/libproc/common/Pfdinfo.c +++ b/usr/src/lib/libproc/common/Pfdinfo.c @@ -12,6 +12,9 @@ /* * Copyright 2012 DEY Storage Systems, Inc. All rights reserved. */ +/* + * Copyright (c) 2013 Joyent, Inc. All Rights reserved. + */ #include <limits.h> #include <stdio.h> @@ -159,7 +162,7 @@ Pfdinfo_iter(struct ps_prochandle *P, proc_fdinfo_f *func, void *cd) /* NB: We walk the list backwards. */ for (fip = list_prev(&P->fd_head); - fip != (void *)&P->fd_head; + fip != (void *)&P->fd_head && fip != NULL; fip = list_prev(fip)) { if ((rv = func(cd, &fip->fd_info)) != 0) return (rv); |