From f0ebd3744df6a4765d1996aef9897356d77d9df3 Mon Sep 17 00:00:00 2001
From: Leif Stensson <leif@lysator.liu.se>
Date: Tue, 24 Oct 2000 14:25:27 +0200
Subject: [PATCH] Added error check to avoid fatal error when trying to read
 from an uninitialized UDP object.

Rev: src/modules/files/udp.c:1.17
---
 src/modules/files/udp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/modules/files/udp.c b/src/modules/files/udp.c
index e64301962e..d3851244cc 100644
--- a/src/modules/files/udp.c
+++ b/src/modules/files/udp.c
@@ -1,5 +1,5 @@
 /*
- * $Id: udp.c,v 1.16 2000/10/12 20:22:57 mirar Exp $
+ * $Id: udp.c,v 1.17 2000/10/24 12:25:27 leif Exp $
  */
 
 #define NO_PIKE_SHORTHAND
@@ -7,7 +7,7 @@
 
 #include "file_machine.h"
 
-RCSID("$Id: udp.c,v 1.16 2000/10/12 20:22:57 mirar Exp $");
+RCSID("$Id: udp.c,v 1.17 2000/10/24 12:25:27 leif Exp $");
 #include "fdlib.h"
 #include "interpret.h"
 #include "svalue.h"
@@ -331,6 +331,8 @@ void udp_read(INT32 args)
   }
   pop_n_elems(args);
   fd = FD;
+  if (FD < 0)
+    error("UDP: not open\n");
   do {
     THREADS_ALLOW();
     res = fd_recvfrom(fd, buffer, UDP_BUFFSIZE, flags,
-- 
GitLab