diff options
author | 2018-12-12 17:55:28 +0000 | |
---|---|---|
committer | 2018-12-12 17:55:28 +0000 | |
commit | 2b4a4494b382e552079b600e1d3fda602ab751c1 (patch) | |
tree | 938cd090318c9cb361dac7511153d281d7c306f3 | |
parent | document show-indexed (diff) | |
download | wireguard-openbsd-2b4a4494b382e552079b600e1d3fda602ab751c1.tar.xz wireguard-openbsd-2b4a4494b382e552079b600e1d3fda602ab751c1.zip |
allow reading from stdin with -f -.
ok kn
-rw-r--r-- | usr.bin/kdump/kdump.1 | 7 | ||||
-rw-r--r-- | usr.bin/kdump/kdump.c | 12 |
2 files changed, 12 insertions, 7 deletions
diff --git a/usr.bin/kdump/kdump.1 b/usr.bin/kdump/kdump.1 index 4369b3f865d..147baf2d314 100644 --- a/usr.bin/kdump/kdump.1 +++ b/usr.bin/kdump/kdump.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: kdump.1,v 1.32 2016/07/18 09:36:50 guenther Exp $ +.\" $OpenBSD: kdump.1,v 1.33 2018/12/12 17:55:28 tedu Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)kdump.1 8.1 (Berkeley) 6/6/93 .\" -.Dd $Mdocdate: July 18 2016 $ +.Dd $Mdocdate: December 12 2018 $ .Dt KDUMP 1 .Os .Sh NAME @@ -61,6 +61,9 @@ By default, values are printed out in hexadecimal. .It Fl f Ar file Display the specified file instead of .Pa ktrace.out . +Specifying +.Sq - +will read from standard input. .It Fl H Display thread identifiers. .It Fl l diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index 20e279be061..0af6b2ea7ef 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kdump.c,v 1.135 2018/10/21 19:56:26 guenther Exp $ */ +/* $OpenBSD: kdump.c,v 1.136 2018/12/12 17:55:28 tedu Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -208,16 +208,18 @@ main(int argc, char *argv[]) if (argc > optind) usage(); - if (unveil(tracefile, "r") == -1) - err(1, "unveil"); + if (strcmp(tracefile, "-") != 0) + if (unveil(tracefile, "r") == -1) + err(1, "unveil"); if (pledge("stdio rpath getpw", NULL) == -1) err(1, "pledge"); m = malloc(size = 1025); if (m == NULL) err(1, NULL); - if (!freopen(tracefile, "r", stdin)) - err(1, "%s", tracefile); + if (strcmp(tracefile, "-") != 0) + if (!freopen(tracefile, "r", stdin)) + err(1, "%s", tracefile); if (fread_tail(&ktr_header, sizeof(struct ktr_header), 1) == 0 || ktr_header.ktr_type != htobe32(KTR_START)) |