about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-10-08 10:04:29 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-10-08 10:04:29 -0700
commite5360e0611be0cba2bef7fda687fe8efdee2b72a (patch)
treee4dd7a8348e0751b8691060137540416cabe80ea
parenta7c59e3e330e83af666e70d3c8f4455ca5aebbb7 (diff)
downloadmu-e5360e0611be0cba2bef7fda687fe8efdee2b72a.tar.gz
3477
-rw-r--r--091socket.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/091socket.cc b/091socket.cc
index b5afa26c..91d574e6 100644
--- a/091socket.cc
+++ b/091socket.cc
@@ -55,6 +55,11 @@ case _OPEN_SERVER_SOCKET: {
 socket_t* server_socket(int portno) {
   socket_t* result = new socket_t;
   result->fd = socket(AF_INET, SOCK_STREAM, 0);
+  if (result->fd < 0) {
+    raise << "Failed to create server socket.\n" << end();
+    delete result;
+    return NULL;
+  }
   int dummy = 0;
   setsockopt(result->fd, SOL_SOCKET, SO_REUSEADDR, &dummy, sizeof(dummy));
   result->addr.sin_family = AF_INET;