summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--netsniff-ng.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/netsniff-ng.c b/netsniff-ng.c
index ad5fd04..94fb313 100644
--- a/netsniff-ng.c
+++ b/netsniff-ng.c
@@ -289,10 +289,9 @@ static void pcap_to_xmit(struct ctx *ctx)
if (__pcap_io->prepare_close_pcap)
__pcap_io->prepare_close_pcap(fd, PCAP_MODE_RD);
- if (strncmp("-", ctx->device_in, strlen("-")))
- close(fd);
- else
+ if (!strncmp("-", ctx->device_in, strlen("-")))
dup2(fd, fileno(stdin));
+ close(fd);
close(tx_sock);
@@ -619,16 +618,14 @@ static void read_pcap(struct ctx *ctx)
printf("\r%12lu bytes outgoing\n", ctx->tx_bytes);
printf("\r%12lu sec, %lu usec in total\n", diff.tv_sec, diff.tv_usec);
- if (strncmp("-", ctx->device_in, strlen("-")))
- close(fd);
- else
+ if (!strncmp("-", ctx->device_in, strlen("-")))
dup2(fd, fileno(stdin));
+ close(fd);
if (ctx->device_out) {
- if (strncmp("-", ctx->device_out, strlen("-")))
- close(fdo);
- else
+ if (!strncmp("-", ctx->device_out, strlen("-")))
dup2(fdo, fileno(stdout));
+ close(fdo);
}
}
class='button' href='/cgit.cgi/linux/net-next.git/log/net/sunrpc/auth_gss/gss_krb5_mech.c?h=nds-private-remove&id=2c6262b754f3c3338cb40b23880a3ac1f4693b25'>logplain -rw-r--r--gss_krb5_seal.c6772logplain -rw-r--r--gss_krb5_seqnum.c4645logplain -rw-r--r--gss_krb5_unseal.c6813logplain -rw-r--r--gss_krb5_wrap.c18005logplain -rw-r--r--gss_mech_switch.c12603logplain -rw-r--r--gss_rpc_upcall.c9707logplain