Module Name: src
Committed By: pooka
Date: Thu Aug 12 18:22:40 UTC 2010
Modified Files:
src/sys/rump/net/lib/libshmif: dumpbus.c
Log Message:
Recognize ``-'' for stdout. allows piping output to tcpdump -r -
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/rump/net/lib/libshmif/dumpbus.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/rump/net/lib/libshmif/dumpbus.c
diff -u src/sys/rump/net/lib/libshmif/dumpbus.c:1.4 src/sys/rump/net/lib/libshmif/dumpbus.c:1.5
--- src/sys/rump/net/lib/libshmif/dumpbus.c:1.4 Thu Aug 12 18:17:23 2010
+++ src/sys/rump/net/lib/libshmif/dumpbus.c Thu Aug 12 18:22:40 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: dumpbus.c,v 1.4 2010/08/12 18:17:23 pooka Exp $ */
+/* $NetBSD: dumpbus.c,v 1.5 2010/08/12 18:22:40 pooka Exp $ */
/*
* Little utility to convert shmif bus traffic to a pcap file
@@ -83,9 +83,13 @@
if (pcapfile) {
struct pcap_file_header phdr;
- pfd = open(pcapfile, O_RDWR | O_CREAT, 0777);
- if (pfd == -1)
- err(1, "create pcap dump");
+ if (strcmp(pcapfile, "-") == 0) {
+ pfd = STDOUT_FILENO;
+ } else {
+ pfd = open(pcapfile, O_RDWR | O_CREAT, 0777);
+ if (pfd == -1)
+ err(1, "create pcap dump");
+ }
memset(&phdr, 0, sizeof(phdr));
phdr.magic = 0xa1b2c3d4; /* tcpdump magic */