From 17a1ac252f7abdc8dfafc6dbd7ed31ff9e430d16 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Mon, 3 Jan 2011 14:47:31 -0500 Subject: - in main(), return an error exit status if socket() fails (defect #10101) --- src/portmap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/portmap.c b/src/portmap.c index b756247..ea2a05f 100644 --- a/src/portmap.c +++ b/src/portmap.c @@ -78,6 +78,10 @@ main(int argc, char **argv) { int s, ret, port; s = socket(PF_INET, SOCK_DGRAM, 0); + if (s == -1) { + printf("error allocating socket\n"); + return 1; + } if ((port = portmap_bind_resvport(s, AF_INET, 0)) < 0) { printf("error binding to reserved port, using 541\n"); port = 541; /* arbitrary */ -- cgit