]> sjero.net Git - wget/blobdiff - src/sysdep.h
[svn] New function xsleep that resumes sleeps interrupted by signals
[wget] / src / sysdep.h
index 0d006ecd6b897c5f44eadc15bbe7a8c9bd112cb7..2c94579501ebb83edcacbca747693f56ca9ed138 100644 (file)
@@ -111,8 +111,8 @@ so, delete this exception statement from your version.  */
 #ifdef __BEOS__
 # undef READ
 # undef WRITE
-# define READ(fd, buf, cnt) recv((fd), (buf), (cnt), 0)
-# define WRITE(fd, buf, cnt) send((fd), (buf), (cnt), 0)
+# define READ(fd, buf, cnt) recv ((fd), (buf), (cnt), 0)
+# define WRITE(fd, buf, cnt) send ((fd), (buf), (cnt), 0)
 #endif
 
 /* mswindows.h defines these.  */
@@ -126,10 +126,13 @@ so, delete this exception statement from your version.  */
 # define REALCLOSE(x) close (x)
 #endif
 
-#define CLOSE(x)                               \
-do {                                           \
-  REALCLOSE (x);                               \
-  DEBUGP (("Closing fd %d\n", x));             \
+#define CLOSE(x) do {                          \
+  int C_sock = (x);                            \
+  if (C_sock >= 0)                             \
+    {                                          \
+      REALCLOSE (C_sock);                      \
+      DEBUGP (("Closing fd %d\n", C_sock));    \
+    }                                          \
 } while (0)
 
 /* Define a large integral type useful for storing large sizes that
@@ -180,9 +183,6 @@ int snprintf ();
 #ifndef HAVE_VSNPRINTF
 int vsnprintf ();
 #endif
-#ifndef HAVE_USLEEP
-int usleep PARAMS ((unsigned long));
-#endif
 #ifndef HAVE_MEMMOVE
 void *memmove ();
 #endif