bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCHv2 5/4] nonblocking: reduce dependency


From: Bruno Haible
Subject: Re: [PATCHv2 5/4] nonblocking: reduce dependency
Date: Mon, 18 Apr 2011 02:35:44 +0200
User-agent: KMail/1.9.9

Hi Eric,

>  2011-04-08  Eric Blake  <address@hidden>
> 
> +     nonblocking: reduce dependency
> +     * tests/test-nonblocking.c: Only test sockets when in use.
> +     * modules/nonblocking-tests (Depends-on): Drop socket.
> +     (Makefile.am): Link even if sockets are not present.
> +     * modules/pipe2-tests (Makefile.am): Likewise.
> +     * lib/ioctl.c (ioctl) [WIN32]: Fail if sockets are not also in use.
> ...
> --- a/lib/ioctl.c
> +++ b/lib/ioctl.c
> @@ -54,6 +54,7 @@ rpl_ioctl (int fd, int request, ... /* {void *,char *} arg 
> */)
>  int
>  ioctl (int fd, int req, ...)
>  {
> +# if GNULIB_SOCKET
>    void *buf;
>    va_list args;
>    SOCKET sock;
> @@ -73,6 +74,11 @@ ioctl (int fd, int req, ...)
>      set_winsock_errno ();
> 
>    return r;
> +
> +# else
> +  errno = ENOSYS;
> +  return -1;
> +# endif
>  }

The intention was good. But this patch does not work for two reasons:

1) The preprocessor macro GNULIB_SOCKET is nowhere defined. Therefore it is
   equivalent to a #if 0. Your patch effectively disabled ioctl() support
   on mingw. As a consequence, I see this test failure:

       test-nonblocking-socket-main.c:89: assertion failed
       FAIL: test-nonblocking-socket.sh

   both in a testdir for 'nonblocking' (no sockets) and in a testdir for
   'nonblocking socket'.

When I replace it with "#if WINDOWS_SOCKETS" or "#if 1", then
test-nonblocking-pipe-main.exe does not link any more:

  gcc-3 -mno-cygwin  -g -O2  -L/usr/local/mingw/lib -o 
test-nonblocking-pipe-main.exe test-nonblocking-pipe-main.o ../gllib/libgnu.a 
  ../gllib/libgnu.a(ioctl.o): In function `ioctl':
/home/bruno/testdir1/gllib/ioctl.c:76: undefined reference to address@hidden'
  ../gllib/libgnu.a(ioctl.o): In function `ioctl':
/home/bruno/testdir1/gllib/w32sock.h:34: undefined reference to address@hidden'
  collect2: ld returned 1 exit status
  make[4]: *** [test-nonblocking-pipe-main.exe] Error 1

2) We want that set_nonblocking_flag DOES use ioctlsocket() when the argument
is a socket. But we DON'T want that linking with the 'nonblocking' module
requires linking with the Win32 socket libraries. This is an apparent dilemma.

The solution is the same as for the close-hook. We can introduce another list
for 'ioctl' hooks, or use a single hook for both 'close' and 'ioctl'. I find
the latter more appropriate, because the use-case for both is the same.

Here's a proposed patch:


From b7d23617875e1498f3b3ea8c6e6e31d6d9195bf9 Mon Sep 17 00:00:00 2001
From: Bruno Haible <address@hidden>
Date: Mon, 18 Apr 2011 02:34:47 +0200
Subject: [PATCH] Generalize close-hook to fd-hook.

---
 lib/close-hook.c         |   91 -------------------------------
 lib/close-hook.h         |   72 ------------------------
 lib/close.c              |    2 +-
 lib/fd-hook.c            |  135 ++++++++++++++++++++++++++++++++++++++++++++++
 lib/fd-hook.h            |   94 ++++++++++++++++++++++++++++++++
 lib/ioctl.c              |   41 ++++++--------
 lib/sockets.c            |   45 +++++++++++++--
 modules/close            |    2 +-
 modules/close-hook       |   23 --------
 modules/fd-hook          |   23 ++++++++
 modules/sockets          |    2 +-
 tests/test-nonblocking.c |    4 +-
 12 files changed, 314 insertions(+), 220 deletions(-)
 delete mode 100644 lib/close-hook.c
 delete mode 100644 lib/close-hook.h
 create mode 100644 lib/fd-hook.c
 create mode 100644 lib/fd-hook.h
 delete mode 100644 modules/close-hook
 create mode 100644 modules/fd-hook

diff --git a/lib/close-hook.c b/lib/close-hook.c
deleted file mode 100644
index 0fdf323..0000000
--- a/lib/close-hook.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Hook for making the close() function extensible.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
-   Written by Bruno Haible <address@hidden>, 2009.
-
-   This program is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Lesser General Public License as published
-   by the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include "close-hook.h"
-
-#include <stdlib.h>
-#include <unistd.h>
-
-#undef close
-
-
-/* Currently, this entire code is only needed for the handling of sockets
-   on native Windows platforms.  */
-#if WINDOWS_SOCKETS
-
-/* The first and last link in the doubly linked list.
-   Initially the list is empty.  */
-static struct close_hook anchor = { &anchor, &anchor, NULL };
-
-int
-execute_close_hooks (int fd, const struct close_hook *remaining_list)
-{
-  if (remaining_list == &anchor)
-    /* End of list reached.  */
-    return close (fd);
-  else
-    return remaining_list->private_fn (fd, remaining_list->private_next);
-}
-
-int
-execute_all_close_hooks (int fd)
-{
-  return execute_close_hooks (fd, anchor.private_next);
-}
-
-void
-register_close_hook (close_hook_fn hook, struct close_hook *link)
-{
-  if (link->private_next == NULL && link->private_prev == NULL)
-    {
-      /* Add the link to the doubly linked list.  */
-      link->private_next = anchor.private_next;
-      link->private_prev = &anchor;
-      link->private_fn = hook;
-      anchor.private_next->private_prev = link;
-      anchor.private_next = link;
-    }
-  else
-    {
-      /* The link is already in use.  */
-      if (link->private_fn != hook)
-        abort ();
-    }
-}
-
-void
-unregister_close_hook (struct close_hook *link)
-{
-  struct close_hook *next = link->private_next;
-  struct close_hook *prev = link->private_prev;
-
-  if (next != NULL && prev != NULL)
-    {
-      /* The link is in use.  Remove it from the doubly linked list.  */
-      prev->private_next = next;
-      next->private_prev = prev;
-      /* Clear the link, to mark it unused.  */
-      link->private_next = NULL;
-      link->private_prev = NULL;
-      link->private_fn = NULL;
-    }
-}
-
-#endif
diff --git a/lib/close-hook.h b/lib/close-hook.h
deleted file mode 100644
index adcf11c..0000000
--- a/lib/close-hook.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Hook for making the close() function extensible.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Lesser General Public License as published
-   by the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-
-#ifndef CLOSE_HOOK_H
-#define CLOSE_HOOK_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Currently, this entire code is only needed for the handling of sockets
-   on native Windows platforms.  */
-#if WINDOWS_SOCKETS
-
-
-/* An element of the list of close hooks.
-   The fields of this structure are considered private.  */
-struct close_hook
-{
-  /* Doubly linked list.  */
-  struct close_hook *private_next;
-  struct close_hook *private_prev;
-  /* Function that treats the types of FD that it knows about and calls
-     execute_close_hooks (FD, REMAINING_LIST) as a fallback.  */
-  int (*private_fn) (int fd, const struct close_hook *remaining_list);
-};
-
-/* This type of function closes FD, applying special knowledge for the FD
-   types it knows about, and calls execute_close_hooks (FD, REMAINING_LIST)
-   for the other FD types.  */
-typedef int (*close_hook_fn) (int fd, const struct close_hook *remaining_list);
-
-/* Execute the close hooks in REMAINING_LIST.
-   Return 0 or -1, like close() would do.  */
-extern int execute_close_hooks (int fd, const struct close_hook 
*remaining_list);
-
-/* Execute all close hooks.
-   Return 0 or -1, like close() would do.  */
-extern int execute_all_close_hooks (int fd);
-
-/* Add a function to the list of close hooks.
-   The LINK variable points to a piece of memory which is guaranteed to be
-   accessible until the corresponding call to unregister_close_hook.  */
-extern void register_close_hook (close_hook_fn hook, struct close_hook *link);
-
-/* Removes a function from the list of close hooks.  */
-extern void unregister_close_hook (struct close_hook *link);
-
-
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* CLOSE_HOOK_H */
diff --git a/lib/close.c b/lib/close.c
index 1c06c16..7ea5434 100644
--- a/lib/close.c
+++ b/lib/close.c
@@ -19,7 +19,7 @@
 /* Specification.  */
 #include <unistd.h>
 
-#include "close-hook.h"
+#include "fd-hook.h"
 
 /* Override close() to call into other gnulib modules.  */
 
diff --git a/lib/fd-hook.c b/lib/fd-hook.c
new file mode 100644
index 0000000..2b850ca
--- /dev/null
+++ b/lib/fd-hook.c
@@ -0,0 +1,135 @@
+/* Hook for making making file descriptor functions close(), ioctl() 
extensible.
+   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <address@hidden>, 2009.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Lesser General Public License as published
+   by the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "fd-hook.h"
+
+#include <errno.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#undef close
+#undef ioctl
+
+
+/* Currently, this entire code is only needed for the handling of sockets
+   on native Windows platforms.  */
+#if WINDOWS_SOCKETS
+
+/* The first and last link in the doubly linked list.
+   Initially the list is empty.  */
+static struct fd_hook anchor = { &anchor, &anchor, NULL, NULL };
+
+int
+execute_close_hooks (const struct fd_hook *remaining_list, int fd)
+{
+  if (remaining_list == &anchor)
+    /* End of list reached.  */
+    return close (fd);
+  else
+    return remaining_list->private_close_fn (remaining_list->private_next, fd);
+}
+
+int
+execute_all_close_hooks (int fd)
+{
+  return execute_close_hooks (anchor.private_next, fd);
+}
+
+int
+execute_ioctl_hooks (const struct fd_hook *remaining_list, int fd, int 
request, ...)
+{
+  void *buf;
+  va_list args;
+
+  va_start (args, request);
+  buf = va_arg (args, void *);
+  va_end (args);
+
+  if (remaining_list == &anchor)
+    {
+      /* End of list reached.  Cf. stub_ioctl.  */
+      errno = ENOSYS;
+      return -1;
+    }
+  else
+    return remaining_list->private_ioctl_fn (remaining_list->private_next, fd, 
request, buf);
+}
+
+int
+execute_all_ioctl_hooks (int fd, int request, ...)
+{
+  void *buf;
+  va_list args;
+
+  va_start (args, request);
+  buf = va_arg (args, void *);
+  va_end (args);
+
+  return execute_ioctl_hooks (anchor.private_next, fd, request, buf);
+}
+
+void
+register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook, struct 
fd_hook *link)
+{
+  if (close_hook == NULL)
+    close_hook = execute_close_hooks;
+  if (ioctl_hook == NULL)
+    ioctl_hook = execute_ioctl_hooks;
+
+  if (link->private_next == NULL && link->private_prev == NULL)
+    {
+      /* Add the link to the doubly linked list.  */
+      link->private_next = anchor.private_next;
+      link->private_prev = &anchor;
+      link->private_close_fn = close_hook;
+      link->private_ioctl_fn = ioctl_hook;
+      anchor.private_next->private_prev = link;
+      anchor.private_next = link;
+    }
+  else
+    {
+      /* The link is already in use.  */
+      if (link->private_close_fn != close_hook
+          || link->private_ioctl_fn != ioctl_hook)
+        abort ();
+    }
+}
+
+void
+unregister_fd_hook (struct fd_hook *link)
+{
+  struct fd_hook *next = link->private_next;
+  struct fd_hook *prev = link->private_prev;
+
+  if (next != NULL && prev != NULL)
+    {
+      /* The link is in use.  Remove it from the doubly linked list.  */
+      prev->private_next = next;
+      next->private_prev = prev;
+      /* Clear the link, to mark it unused.  */
+      link->private_next = NULL;
+      link->private_prev = NULL;
+      link->private_close_fn = NULL;
+      link->private_ioctl_fn = NULL;
+    }
+}
+
+#endif
diff --git a/lib/fd-hook.h b/lib/fd-hook.h
new file mode 100644
index 0000000..8e87b90
--- /dev/null
+++ b/lib/fd-hook.h
@@ -0,0 +1,94 @@
+/* Hook for making making file descriptor functions close(), ioctl() 
extensible.
+   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Lesser General Public License as published
+   by the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+
+#ifndef FD_HOOK_H
+#define FD_HOOK_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Currently, this entire code is only needed for the handling of sockets
+   on native Windows platforms.  */
+#if WINDOWS_SOCKETS
+
+
+/* An element of the list of file descriptor hooks.
+   The fields of this structure are considered private.  */
+struct fd_hook
+{
+  /* Doubly linked list.  */
+  struct fd_hook *private_next;
+  struct fd_hook *private_prev;
+  /* Function that treats the types of FD that it knows about and calls
+     execute_close_hooks (REMAINING_LIST, FD) as a fallback.  */
+  int (*private_close_fn) (const struct fd_hook *remaining_list, int fd);
+  /* Function that treats the types of FD that it knows about and calls
+     execute_ioctl_hooks (REMAINING_LIST, FD, REQUEST, ...) as a fallback.  */
+  int (*private_ioctl_fn) (const struct fd_hook *remaining_list, int fd,
+                           int request, ...);
+};
+
+/* This type of function closes FD, applying special knowledge for the FD
+   types it knows about, and calls execute_close_hooks (REMAINING_LIST, FD)
+   for the other FD types.  */
+typedef int (*close_hook_fn) (const struct fd_hook *remaining_list, int fd);
+
+/* Execute the close hooks in REMAINING_LIST.
+   Return 0 or -1, like close() would do.  */
+extern int execute_close_hooks (const struct fd_hook *remaining_list, int fd);
+
+/* Execute all close hooks.
+   Return 0 or -1, like close() would do.  */
+extern int execute_all_close_hooks (int fd);
+
+/* This type of function applies a control request to FD, applying special
+   knowledge for the FD types it knows about, and calls
+   execute_ioctl_hooks (REMAINING_LIST, FD, REQUEST, ...)
+   for the other FD types.  */
+typedef int (*ioctl_hook_fn) (const struct fd_hook *remaining_list, int fd,
+                              int request, ...);
+
+/* Execute the ioctl hooks in REMAINING_LIST.
+   Return 0 or -1, like ioctl() would do.  */
+extern int execute_ioctl_hooks (const struct fd_hook *remaining_list, int fd,
+                                int request, ...);
+
+/* Execute all ioctl hooks.
+   Return 0 or -1, like ioctl() would do.  */
+extern int execute_all_ioctl_hooks (int fd, int request, ...);
+
+/* Add a function pair to the list of file descriptor hooks.
+   CLOSE_HOOK and IOCTL_HOOK may be NULL, indicating no change.
+   The LINK variable points to a piece of memory which is guaranteed to be
+   accessible until the corresponding call to unregister_fd_hook.  */
+extern void register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn 
ioctl_hook,
+                              struct fd_hook *link);
+
+/* Removes a hook from the list of file descriptor hooks.  */
+extern void unregister_fd_hook (struct fd_hook *link);
+
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FD_HOOK_H */
diff --git a/lib/ioctl.c b/lib/ioctl.c
index 00caf3b..f01e40a 100644
--- a/lib/ioctl.c
+++ b/lib/ioctl.c
@@ -44,40 +44,35 @@ rpl_ioctl (int fd, int request, ... /* {void *,char *} arg 
*/)
 
 #else /* mingw */
 
-# define WIN32_LEAN_AND_MEAN
-/* Get winsock2.h. */
-# include <sys/socket.h>
+# include <errno.h>
 
-/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-# include "w32sock.h"
+# include "fd-hook.h"
+
+static int
+stub_ioctl (int fd, int request, ...)
+{
+  /* We don't support FIONBIO on pipes here.  If you want to make pipe
+     fds non-blocking, use the gnulib 'nonblocking' module, until
+     gnulib implements fcntl F_GETFL / F_SETFL with O_NONBLOCK.  */
+
+  errno = ENOSYS;
+  return -1;
+}
 
 int
-ioctl (int fd, int req, ...)
+ioctl (int fd, int request, ...)
 {
-# if GNULIB_SOCKET
   void *buf;
   va_list args;
-  SOCKET sock;
-  int r;
 
-  va_start (args, req);
+  va_start (args, request);
   buf = va_arg (args, void *);
   va_end (args);
 
-  /* We don't support FIONBIO on pipes here.  If you want to make pipe
-     fds non-blocking, use the gnulib 'nonblocking' module, until
-     gnulib implements fcntl F_GETFL / F_SETFL with O_NONBLOCK.  */
-
-  sock = FD_TO_SOCKET (fd);
-  r = ioctlsocket (sock, req, buf);
-  if (r < 0)
-    set_winsock_errno ();
-
-  return r;
-
+# if WINDOWS_SOCKETS
+  return execute_all_ioctl_hooks (fd, request, buf);
 # else
-  errno = ENOSYS;
-  return -1;
+  return stub_ioctl (fd, request, buf);
 # endif
 }
 
diff --git a/lib/sockets.c b/lib/sockets.c
index 4e905e1..77dfb94 100644
--- a/lib/sockets.c
+++ b/lib/sockets.c
@@ -27,13 +27,13 @@
 /* This includes winsock2.h on MinGW. */
 # include <sys/socket.h>
 
-# include "close-hook.h"
+# include "fd-hook.h"
 
 /* Get set_winsock_errno, FD_TO_SOCKET etc. */
 # include "w32sock.h"
 
 static int
-close_fd_maybe_socket (int fd, const struct close_hook *remaining_list)
+close_fd_maybe_socket (const struct fd_hook *remaining_list, int fd)
 {
   SOCKET sock;
   WSANETWORKEVENTS ev;
@@ -64,10 +64,42 @@ close_fd_maybe_socket (int fd, const struct close_hook 
*remaining_list)
     }
   else
     /* Some other type of file descriptor.  */
-    return execute_close_hooks (fd, remaining_list);
+    return execute_close_hooks (remaining_list, fd);
 }
 
-static struct close_hook close_sockets_hook;
+static int
+ioctl_fd_maybe_socket (const struct fd_hook *remaining_list, int fd, int 
request, ...)
+{
+  void *buf;
+  va_list args;
+  SOCKET sock;
+  WSANETWORKEVENTS ev;
+
+  va_start (args, request);
+  buf = va_arg (args, void *);
+  va_end (args);
+
+  /* Test whether fd refers to a socket.  */
+  sock = FD_TO_SOCKET (fd);
+  ev.lNetworkEvents = 0xDEADBEEF;
+  WSAEnumNetworkEvents (sock, NULL, &ev);
+  if (ev.lNetworkEvents != 0xDEADBEEF)
+    {
+      /* fd refers to a socket.  */
+      if (ioctlsocket (sock, request, buf) < 0)
+        {
+          set_winsock_errno ();
+          return -1;
+        }
+      else
+        return 0;
+    }
+  else
+    /* Some other type of file descriptor.  */
+    return execute_ioctl_hooks (remaining_list, fd, request, buf);
+}
+
+static struct fd_hook fd_sockets_hook;
 
 static int initialized_sockets_version /* = 0 */;
 
@@ -90,7 +122,8 @@ gl_sockets_startup (int version _GL_UNUSED)
         return 2;
 
       if (initialized_sockets_version == 0)
-        register_close_hook (close_fd_maybe_socket, &close_sockets_hook);
+        register_fd_hook (close_fd_maybe_socket, ioctl_fd_maybe_socket,
+                          &fd_sockets_hook);
 
       initialized_sockets_version = version;
     }
@@ -107,7 +140,7 @@ gl_sockets_cleanup (void)
 
   initialized_sockets_version = 0;
 
-  unregister_close_hook (&close_sockets_hook);
+  unregister_fd_hook (&fd_sockets_hook);
 
   err = WSACleanup ();
   if (err != 0)
diff --git a/modules/close b/modules/close
index e294292..88e1608 100644
--- a/modules/close
+++ b/modules/close
@@ -7,7 +7,7 @@ m4/close.m4
 
 Depends-on:
 unistd
-close-hook
+fd-hook
 fclose
 
 configure.ac:
diff --git a/modules/close-hook b/modules/close-hook
deleted file mode 100644
index ae32ad0..0000000
--- a/modules/close-hook
+++ /dev/null
@@ -1,23 +0,0 @@
-Description:
-Hook for making close() extensible.
-
-Files:
-lib/close-hook.h
-lib/close-hook.c
-
-Depends-on:
-unistd
-
-configure.ac:
-
-Makefile.am:
-lib_SOURCES += close-hook.c
-
-Include:
-"close-hook.h"
-
-License:
-LGPLv2+
-
-Maintainer:
-Bruno Haible
diff --git a/modules/fd-hook b/modules/fd-hook
new file mode 100644
index 0000000..7127083
--- /dev/null
+++ b/modules/fd-hook
@@ -0,0 +1,23 @@
+Description:
+Hook for making file descriptor functions (close(), ioctl()) extensible.
+
+Files:
+lib/fd-hook.h
+lib/fd-hook.c
+
+Depends-on:
+unistd
+
+configure.ac:
+
+Makefile.am:
+lib_SOURCES += fd-hook.c
+
+Include:
+"fd-hook.h"
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible
diff --git a/modules/sockets b/modules/sockets
index b79a02f..fe92926 100644
--- a/modules/sockets
+++ b/modules/sockets
@@ -10,7 +10,7 @@ m4/sockets.m4
 Depends-on:
 socketlib
 sys_socket
-close-hook
+fd-hook
 
 configure.ac:
 gl_SOCKETS
diff --git a/tests/test-nonblocking.c b/tests/test-nonblocking.c
index bfeef7b..f3f1f13 100644
--- a/tests/test-nonblocking.c
+++ b/tests/test-nonblocking.c
@@ -79,7 +79,7 @@ main (void)
   ASSERT (close (fd_pipe[1]) == 0);
 #endif /* GNULIB_TEST_PIPE2 */
 
-#if GNULIB_SOCKET
+#if GNULIB_TEST_SOCKET
   {
     /* Test sockets.  */
     bool sock_works = true;
@@ -104,7 +104,7 @@ main (void)
     ASSERT (close (fd_sock) == 0);
 # endif /* SOCK_NONBLOCK */
   }
-#endif /* GNULIB_SOCKET */
+#endif /* GNULIB_TEST_SOCKET */
 
   /* Test error handling.  */
   {
-- 
1.6.3.2

-- 
In memoriam Max Josef Metzger <http://en.wikipedia.org/wiki/Max_Josef_Metzger>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]