Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/ps Don't print junk errnos. Avoids:
details: https://anonhg.NetBSD.org/src/rev/a7d271ec982d
branches: trunk
changeset: 330193:a7d271ec982d
user: dholland <dholland%NetBSD.org@localhost>
date: Sat Jun 28 17:32:27 2014 +0000
description:
Don't print junk errnos. Avoids:
% ps -tfoo
ps: /dev/ttyfoo: Undefined error: 0
Exit 1
diffstat:
bin/ps/ps.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diffs (39 lines):
diff -r 0160a3004f18 -r a7d271ec982d bin/ps/ps.c
--- a/bin/ps/ps.c Sat Jun 28 15:52:45 2014 +0000
+++ b/bin/ps/ps.c Sat Jun 28 17:32:27 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ps.c,v 1.81 2014/04/20 23:31:40 dholland Exp $ */
+/* $NetBSD: ps.c,v 1.82 2014/06/28 17:32:27 dholland Exp $ */
/*
* Copyright (c) 2000-2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
#if 0
static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94";
#else
-__RCSID("$NetBSD: ps.c,v 1.81 2014/04/20 23:31:40 dholland Exp $");
+__RCSID("$NetBSD: ps.c,v 1.82 2014/06/28 17:32:27 dholland Exp $");
#endif
#endif /* not lint */
@@ -175,8 +175,11 @@
ttypath = ttname;
*what = KERN_PROC_TTY;
if (stat(ttypath, &sb) == -1) {
- devmajor_t pts = getdevmajor("pts", S_IFCHR);
+ devmajor_t pts;
+ int serrno;
+ serrno = errno;
+ pts = getdevmajor("pts", S_IFCHR);
if (pts != NODEVMAJOR && strncmp(ttname, "pts/", 4) == 0) {
int ptsminor = atoi(ttname + 4);
@@ -184,6 +187,7 @@
if (strcmp(pathbuf, ttname) == 0 && ptsminor >= 0)
return makedev(pts, ptsminor);
}
+ errno = serrno;
err(1, "%s", ttypath);
}
if (!S_ISCHR(sb.st_mode))
Home |
Main Index |
Thread Index |
Old Index