summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2012-04-01 02:58:58 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2012-04-01 02:58:58 +0000
commit9b47b17a473aae14394cdfd0684e77a2787ddc62 (patch)
tree24c27ed0c2e0e5eaa580632a85fd437041c6a586 /usr.bin
parentedbd19bf09e8f1f466f64427934572821a1ed566 (diff)
error out if accept() fails
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/nc/netcat.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/nc/netcat.c b/usr.bin/nc/netcat.c
index c0a0e474a55..6b372033e75 100644
--- a/usr.bin/nc/netcat.c
+++ b/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netcat.c,v 1.106 2012/03/17 10:16:41 dlg Exp $ */
+/* $OpenBSD: netcat.c,v 1.107 2012/04/01 02:58:57 deraadt Exp $ */
/*
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
*
@@ -369,6 +369,8 @@ main(int argc, char *argv[])
len = sizeof(cliaddr);
connfd = accept(s, (struct sockaddr *)&cliaddr,
&len);
+ if (connfd == -1)
+ err(1, "accept");
readwrite(connfd);
close(connfd);
}