summaryrefslogtreecommitdiff
path: root/bin/ps
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1996-12-22 02:57:53 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1996-12-22 02:57:53 +0000
commite568909a2dfe2282aa7a04e4362269a6bbe1ea6f (patch)
tree06e8ecd4d5adadf7bbe3d072c57fc1ed75151945 /bin/ps
parentcd662cc5ca14c9185fe05b30854c26d3b5fe0525 (diff)
Deal with _POSIX_SAVED_IDS when relinquishing privileges
Diffstat (limited to 'bin/ps')
-rw-r--r--bin/ps/ps.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index 6e4b70e89b5..9d7d64e3da3 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ps.c,v 1.6 1996/12/14 12:18:10 mickey Exp $ */
+/* $OpenBSD: ps.c,v 1.7 1996/12/22 02:57:50 tholo Exp $ */
/* $NetBSD: ps.c,v 1.15 1995/05/18 20:33:25 mycroft Exp $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: ps.c,v 1.6 1996/12/14 12:18:10 mickey Exp $";
+static char rcsid[] = "$OpenBSD: ps.c,v 1.7 1996/12/22 02:57:50 tholo Exp $";
#endif
#endif /* not lint */
@@ -267,8 +267,10 @@ main(argc, argv)
* Discard setgid privileges if not the running kernel so that bad
* guys can't print interesting stuff from kernel memory.
*/
- if (nlistf != NULL || memf != NULL || swapf != NULL)
+ if (nlistf != NULL || memf != NULL || swapf != NULL) {
+ setegid(getgid());
setgid(getgid());
+ }
kd = kvm_openfiles(nlistf, memf, swapf, O_RDONLY, errbuf);
if (kd == 0)