INN commit: trunk (30 files)

INN Commit rra at isc.org
Sat Aug 30 08:08:12 UTC 2014


    Date: Saturday, August 30, 2014 @ 01:08:11
  Author: iulius
Revision: 9659

Sync lib/fdflag.c and include/inn/fdflag.h with latest rra-c-util version

Changes are:

- Rename lib/fdflags.c to lib/fdflag.c.

- Add a new header file:  include/inn/fdflag.h.

- Rename the close_on_exec and nonblocking functions to respectively
fdflag_close_exec and fdflag_nonblocking.  These functions now return
a boolean; fdflag_nonblocking is now prototyped to take a socket_type
instead of an int, but on UNIX this should not make a difference.

- Add an implementation of fdflag_nonblocking for Windows and allow
fdflag.c to be built on Windows.

- Update the libinn documentation to mention these new functions (old
CloseOnExec and SetNonBlocking functions were still documented).

Added:
  trunk/include/inn/fdflag.h
  trunk/lib/fdflag.c
    (from rev 9649, trunk/lib/fdflags.c)
Modified:
  trunk/MANIFEST
  trunk/doc/man/libinn.3
  trunk/frontends/Makefile
  trunk/frontends/ovdb_server.c
  trunk/frontends/rnews.c
  trunk/history/Makefile
  trunk/history/hisv6/hisv6.c
  trunk/include/inn/libinn.h
  trunk/innd/Makefile
  trunk/innd/chan.c
  trunk/innd/icd.c
  trunk/innd/rc.c
  trunk/innd/site.c
  trunk/innd/util.c
  trunk/innfeed/Makefile
  trunk/innfeed/connection.c
  trunk/lib/Makefile
  trunk/lib/dbz.c
  trunk/nnrpd/Makefile
  trunk/nnrpd/commands.c
  trunk/storage/Makefile
  trunk/storage/buffindexed/buffindexed.c
  trunk/storage/cnfs/cnfs.c
  trunk/storage/ovdb/ovdb.c
  trunk/storage/timecaf/timecaf.c
  trunk/storage/tradindexed/tdx-data.c
  trunk/storage/tradindexed/tdx-group.c
Deleted:
  trunk/lib/fdflags.c

-----------------------------------+
 MANIFEST                          |    3 
 doc/man/libinn.3                  |   12 +-
 frontends/Makefile                |   15 ++-
 frontends/ovdb_server.c           |    5 -
 frontends/rnews.c                 |    5 -
 history/Makefile                  |    4 
 history/hisv6/hisv6.c             |    5 -
 include/inn/fdflag.h              |   51 ++++++++++++
 include/inn/libinn.h              |    2 
 innd/Makefile                     |   65 ++++++++-------
 innd/chan.c                       |    5 -
 innd/icd.c                        |    3 
 innd/rc.c                         |    3 
 innd/site.c                       |    3 
 innd/util.c                       |    7 -
 innfeed/Makefile                  |    8 -
 innfeed/connection.c              |    3 
 lib/Makefile                      |   14 ++-
 lib/dbz.c                         |   15 +--
 lib/fdflag.c                      |  151 ++++++++++++++++++++++++++++++++++++
 lib/fdflags.c                     |  103 ------------------------
 nnrpd/Makefile                    |    6 -
 nnrpd/commands.c                  |    7 -
 storage/Makefile                  |   30 ++++---
 storage/buffindexed/buffindexed.c |    5 -
 storage/cnfs/cnfs.c               |    3 
 storage/ovdb/ovdb.c               |    3 
 storage/timecaf/timecaf.c         |    3 
 storage/tradindexed/tdx-data.c    |    5 -
 storage/tradindexed/tdx-group.c   |    3 
 30 files changed, 342 insertions(+), 205 deletions(-)

Modified: MANIFEST
===================================================================
--- MANIFEST	2014-08-28 18:59:18 UTC (rev 9658)
+++ MANIFEST	2014-08-30 08:08:11 UTC (rev 9659)
@@ -383,6 +383,7 @@
 include/inn/dbz.h                     Header file for DBZ
 include/inn/defines.h                 Portable defs for installed headers
 include/inn/dispatch.h                Header file for command dispatching
+include/inn/fdflag.h                  Header file for file descriptor flags
 include/inn/hashtab.h                 Header file for generic hash table
 include/inn/history.h                 Header file for the history API
 include/inn/innconf.h                 Header file for the innconf struct
@@ -488,7 +489,7 @@
 lib/dbz.c                             DBZ database library
 lib/defdist.c                         Determine default Distribution: header
 lib/dispatch.c                        Dispatch a command to a function
-lib/fdflags.c                         Set or clear file descriptor flags
+lib/fdflag.c                          Set or clear file descriptor flags
 lib/fdlimit.c                         File descriptor limits
 lib/fseeko.c                          fseeko replacement
 lib/ftello.c                          ftello replacement

Modified: doc/man/libinn.3
===================================================================
--- doc/man/libinn.3	2014-08-28 18:59:18 UTC (rev 9658)
+++ doc/man/libinn.3	2014-08-30 08:08:11 UTC (rev 9659)
@@ -45,13 +45,13 @@
 .B "    DDHANDLE	*h;"
 
 .B "void"
-.B "close_on_exec(fd, flag)"
+.B "fdflag_close_exec(fd, flag)"
 .B "    int	fd;"
 .B "    bool	flag;"
 
 .B "int"
-.B "nonblocking(fd, flag)"
-.B "    int	fd;"
+.B "fdflag_nonblocking(fd, flag)"
+.B "    socket_type	fd;"
 .B "    bool	flag;"
 
 .B "bool"
@@ -212,7 +212,7 @@
 or
 .IR CAlistopen .
 .PP
-.I CloseOnExec
+.I fdflag_close_exec
 can make a descriptor ``close-on-exec'' so that it is not shared
 with any child processes.
 If the flag is non-zero, the file is so marked; if zero, the ``close-on-exec''
@@ -257,7 +257,7 @@
 releases any state maintained in the handle and returns an allocated copy
 of the text that should be used for the Distribution header.
 .PP
-.I SetNonBlocking
+.I fdflag_nonblocking
 enables (if
 .I flag
 is non-zero) or disables (if
@@ -443,7 +443,7 @@
     Fatal("Can't open active file");
 
 /* Don't pass the file on to our children. */
-CloseOnExec(fileno(F), 1);
+fdflag_close_exec(fileno(F), 1);
 
 /* Make a local copy. */
 p = ReadInDescriptor(fileno(F), (struct stat *)NULL);

Modified: frontends/Makefile
===================================================================
--- frontends/Makefile	2014-08-28 18:59:18 UTC (rev 9658)
+++ frontends/Makefile	2014-08-30 08:08:11 UTC (rev 9659)
@@ -180,10 +180,11 @@
   ../include/portable/time.h ../include/portable/setproctitle.h \
   ../include/portable/socket.h ../include/portable/getaddrinfo.h \
   ../include/portable/getnameinfo.h ../include/portable/wait.h \
-  ../include/inn/innconf.h ../include/inn/defines.h \
-  ../include/inn/messages.h ../include/inn/libinn.h ../include/inn/paths.h \
-  ../include/inn/storage.h ../include/inn/options.h ../include/inn/ov.h \
-  ../include/inn/storage.h ../include/inn/history.h ../storage/ovdb/ovdb.h \
+  ../include/inn/fdflag.h ../include/inn/defines.h \
+  ../include/inn/innconf.h ../include/inn/messages.h \
+  ../include/inn/libinn.h ../include/inn/paths.h ../include/inn/storage.h \
+  ../include/inn/options.h ../include/inn/ov.h ../include/inn/storage.h \
+  ../include/inn/history.h ../storage/ovdb/ovdb.h \
   ../storage/ovdb/ovdb-private.h
 ovdb_stat.o: ovdb_stat.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
@@ -194,8 +195,10 @@
   ../storage/ovdb/ovdb.h ../storage/ovdb/ovdb-private.h
 rnews.o: rnews.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
-  ../include/config.h ../include/portable/wait.h ../include/inn/innconf.h \
-  ../include/inn/defines.h ../include/inn/libinn.h \
+  ../include/config.h ../include/portable/wait.h ../include/inn/fdflag.h \
+  ../include/inn/defines.h ../include/portable/socket.h \
+  ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
+  ../include/inn/innconf.h ../include/inn/libinn.h \
   ../include/inn/messages.h ../include/inn/newsuser.h \
   ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
   ../include/inn/options.h ../include/inn/wire.h

Modified: frontends/ovdb_server.c
===================================================================
--- frontends/ovdb_server.c	2014-08-28 18:59:18 UTC (rev 9658)
+++ frontends/ovdb_server.c	2014-08-30 08:08:11 UTC (rev 9659)
@@ -22,6 +22,7 @@
 # include <sys/un.h>
 #endif
 
+#include "inn/fdflag.h"
 #include "inn/innconf.h"
 #include "inn/messages.h"
 #include "inn/libinn.h"
@@ -380,7 +381,7 @@
     struct reader *r;
     int i;
 
-    nonblocking(fd, 1);
+    fdflag_nonblocking(fd, 1);
 
     if(numreaders >= readertablen) {
     	readertablen += 50;
@@ -646,7 +647,7 @@
     if(listensock < 0)
         sysdie("cannot create socket");
 
-    nonblocking(listensock, 1);
+    fdflag_nonblocking(listensock, 1);
 
     memset(&sa, 0, sizeof sa);
 #ifdef HAVE_UNIX_DOMAIN_SOCKETS

Modified: frontends/rnews.c
===================================================================
--- frontends/rnews.c	2014-08-28 18:59:18 UTC (rev 9658)
+++ frontends/rnews.c	2014-08-30 08:08:11 UTC (rev 9659)
@@ -17,6 +17,7 @@
 #include <syslog.h>
 #include <sys/stat.h>
 
+#include "inn/fdflag.h"
 #include "inn/innconf.h"
 #include "inn/libinn.h"
 #include "inn/messages.h"
@@ -936,8 +937,8 @@
 			CantConnect(buff, mode, fd);
 	}
     }
-    close_on_exec(fileno(FromServer), true);
-    close_on_exec(fileno(ToServer), true);
+    fdflag_close_exec(fileno(FromServer), true);
+    fdflag_close_exec(fileno(ToServer), true);
 
     /* Execute the command. */
     if (mode == 'U')

Modified: history/Makefile
===================================================================
--- history/Makefile	2014-08-28 18:59:18 UTC (rev 9658)
+++ history/Makefile	2014-08-30 08:08:11 UTC (rev 9659)
@@ -112,6 +112,8 @@
   ../include/config.h hisinterface.h hisv6/hisv6.h hisv6/hisv6-private.h \
   ../include/inn/history.h ../include/inn/defines.h \
   ../include/inn/storage.h ../include/inn/options.h \
-  ../include/inn/libinn.h ../include/inn/dbz.h ../include/inn/innconf.h \
+  ../include/inn/libinn.h ../include/inn/dbz.h ../include/inn/fdflag.h \
+  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
+  ../include/portable/getnameinfo.h ../include/inn/innconf.h \
   ../include/inn/timer.h ../include/inn/qio.h ../include/inn/sequence.h \
   ../include/inn/inndcomm.h

Modified: history/hisv6/hisv6.c
===================================================================
--- history/hisv6/hisv6.c	2014-08-28 18:59:18 UTC (rev 9658)
+++ history/hisv6/hisv6.c	2014-08-30 08:08:11 UTC (rev 9659)
@@ -46,6 +46,7 @@
 #include "hisv6.h"
 #include "hisv6-private.h"
 #include "inn/dbz.h"
+#include "inn/fdflag.h"
 #include "inn/innconf.h"
 #include "inn/timer.h"
 #include "inn/qio.h"
@@ -314,7 +315,7 @@
 	    hisv6_closefiles(h);
 	    goto fail;
 	}
-	close_on_exec(fileno(h->writefp), true);
+	fdflag_close_exec(fileno(h->writefp), true);
     }
 
     /* Open the history file for reading. */
@@ -324,7 +325,7 @@
 	hisv6_closefiles(h);
 	goto fail;
     }
-    close_on_exec(h->readfd, true);
+    fdflag_close_exec(h->readfd, true);
     
     /* if there's no current dbz owner, claim it here */
     if (hisv6_dbzowner == NULL) {

Added: include/inn/fdflag.h
===================================================================
--- include/inn/fdflag.h	                        (rev 0)
+++ include/inn/fdflag.h	2014-08-30 08:08:11 UTC (rev 9659)
@@ -0,0 +1,51 @@
+/* $Id$
+ *
+ * Prototypes for setting or clearing file descriptor flags.
+ *
+ * The canonical version of this file is maintained in the rra-c-util package,
+ * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+ *
+ * Copyright 2008, 2010, 2011
+ *     The Board of Trustees of the Leland Stanford Junior University
+ * Copyright (c) 2004, 2005, 2006
+ *     by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+ *     2002, 2003 by The Internet Software Consortium and Rich Salz
+ *
+ * This code is derived from software contributed to the Internet Software
+ * Consortium by Rich Salz.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef INN_FDFLAG_H
+#define INN_FDFLAG_H 1
+
+#include <inn/defines.h>
+#include "portable/socket.h"
+
+BEGIN_DECLS
+
+/*
+ * Set a file descriptor close-on-exec or nonblocking.  fdflag_close_exec is
+ * not supported on Windows and will always return false.  fdflag_nonblocking
+ * is defined to take a socket_type so that it can be supported on Windows.
+ * On UNIX systems, you can safely pass in a non-socket file descriptor, but
+ * be aware that this will fail to compile on Windows.
+ */
+bool fdflag_close_exec(int fd, bool flag);
+bool fdflag_nonblocking(socket_type fd, bool flag);
+
+END_DECLS
+
+#endif /* INN_FDFLAG_H */


Property changes on: trunk/include/inn/fdflag.h
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Modified: include/inn/libinn.h
===================================================================
--- include/inn/libinn.h	2014-08-28 18:59:18 UTC (rev 9658)
+++ include/inn/libinn.h	2014-08-30 08:08:11 UTC (rev 9659)
@@ -138,12 +138,10 @@
 /*
 **  MISCELLANEOUS UTILITY FUNCTIONS
 */
-extern void     close_on_exec(int fd, bool flag);
 extern char *   concat(const char *first, ...);
 extern char *   concatpath(const char *base, const char *name);
 extern void     daemonize(const char *path);
 extern int      getfdlimit(void);
-extern int      nonblocking(int fd, bool flag);
 extern int      setfdlimit(unsigned int limit);
 extern ssize_t  xpwrite(int fd, const void *buffer, size_t size, off_t offset);
 extern void     (*xsignal(int signum, void (*sigfunc)(int)))(int);

Modified: innd/Makefile
===================================================================
--- innd/Makefile	2014-08-28 18:59:18 UTC (rev 9658)
+++ innd/Makefile	2014-08-30 08:08:11 UTC (rev 9659)
@@ -91,23 +91,25 @@
   ../include/inn/inndcomm.h ../include/innperl.h
 chan.o: chan.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
-  ../include/config.h ../include/inn/innconf.h ../include/inn/defines.h \
-  ../include/inn/network.h ../include/portable/socket.h \
+  ../include/config.h ../include/inn/fdflag.h ../include/inn/defines.h \
+  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
+  ../include/portable/getnameinfo.h ../include/inn/innconf.h \
+  ../include/inn/network.h innd.h ../include/portable/time.h \
+  ../include/inn/buffer.h ../include/inn/history.h \
+  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/libinn.h \
+  ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
+  ../include/inn/options.h
+icd.o: icd.c ../include/config.h ../include/inn/defines.h \
+  ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
+  ../include/config.h ../include/portable/mmap.h ../include/inn/fdflag.h \
+  ../include/inn/defines.h ../include/portable/socket.h \
   ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
-  innd.h ../include/portable/time.h ../include/inn/buffer.h \
+  ../include/inn/innconf.h ../include/inn/mmap.h innd.h \
+  ../include/portable/time.h ../include/inn/buffer.h \
   ../include/inn/history.h ../include/inn/messages.h \
   ../include/inn/timer.h ../include/inn/libinn.h ../include/inn/nntp.h \
-  ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h
-icd.o: icd.c ../include/config.h ../include/inn/defines.h \
-  ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
-  ../include/config.h ../include/portable/mmap.h ../include/inn/innconf.h \
-  ../include/inn/defines.h ../include/inn/mmap.h innd.h \
-  ../include/portable/time.h ../include/portable/socket.h \
-  ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
-  ../include/inn/buffer.h ../include/inn/history.h \
-  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/libinn.h \
-  ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
-  ../include/inn/options.h ../include/inn/ov.h ../include/inn/storage.h
+  ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h \
+  ../include/inn/ov.h ../include/inn/storage.h
 innd.o: innd.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h ../include/inn/innconf.h ../include/inn/defines.h \
@@ -198,21 +200,22 @@
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h ../include/portable/socket.h \
   ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
-  ../include/inn/innconf.h ../include/inn/defines.h \
-  ../include/inn/network.h ../include/inn/vector.h innd.h \
+  ../include/inn/fdflag.h ../include/inn/defines.h \
+  ../include/inn/innconf.h ../include/inn/network.h \
+  ../include/inn/vector.h innd.h ../include/portable/time.h \
+  ../include/inn/buffer.h ../include/inn/history.h \
+  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/libinn.h \
+  ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
+  ../include/inn/options.h
+site.o: site.c ../include/config.h ../include/inn/defines.h \
+  ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
+  ../include/config.h ../include/inn/fdflag.h ../include/inn/defines.h \
+  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
+  ../include/portable/getnameinfo.h ../include/inn/innconf.h innd.h \
   ../include/portable/time.h ../include/inn/buffer.h \
   ../include/inn/history.h ../include/inn/messages.h \
   ../include/inn/timer.h ../include/inn/libinn.h ../include/inn/nntp.h \
   ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h
-site.o: site.c ../include/config.h ../include/inn/defines.h \
-  ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
-  ../include/config.h ../include/inn/innconf.h ../include/inn/defines.h \
-  innd.h ../include/portable/time.h ../include/portable/socket.h \
-  ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
-  ../include/inn/buffer.h ../include/inn/history.h \
-  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/libinn.h \
-  ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
-  ../include/inn/options.h
 status.o: status.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h ../include/portable/socket.h \
@@ -226,13 +229,13 @@
   ../include/innperl.h
 util.o: util.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
-  ../include/config.h ../include/inn/innconf.h ../include/inn/defines.h \
+  ../include/config.h ../include/inn/fdflag.h ../include/inn/defines.h \
+  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
+  ../include/portable/getnameinfo.h ../include/inn/innconf.h \
   ../include/inn/libinn.h innd.h ../include/portable/time.h \
-  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
-  ../include/portable/getnameinfo.h ../include/inn/buffer.h \
-  ../include/inn/history.h ../include/inn/messages.h \
-  ../include/inn/timer.h ../include/inn/nntp.h ../include/inn/paths.h \
-  ../include/inn/storage.h ../include/inn/options.h
+  ../include/inn/buffer.h ../include/inn/history.h \
+  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/nntp.h \
+  ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h
 wip.o: wip.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h ../include/inn/innconf.h ../include/inn/defines.h \

Modified: innd/chan.c
===================================================================
--- innd/chan.c	2014-08-28 18:59:18 UTC (rev 9658)
+++ innd/chan.c	2014-08-30 08:08:11 UTC (rev 9659)
@@ -22,6 +22,7 @@
 # include <sys/select.h>
 #endif
 
+#include "inn/fdflag.h"
 #include "inn/innconf.h"
 #include "inn/network.h"
 #include "innd.h"
@@ -203,14 +204,14 @@
     HashClear(&cp->CurrentMessageIDHash);
     ARTprepare(cp);
 
-    close_on_exec(fd, true);
+    fdflag_close_exec(fd, true);
 
 #ifndef _HPUX_SOURCE
     /* Stupid HPUX 11.00 has a broken listen/accept where setting the listen
        socket to nonblocking prevents you from successfully setting the
        socket returned by accept(2) back to blocking mode, no matter what,
        resulting in all kinds of funny behaviour, data loss, etc. etc.  */
-    if (nonblocking(fd, true) < 0 && errno != ENOTSOCK && errno != ENOTTY)
+    if (!fdflag_nonblocking(fd, true) && errno != ENOTSOCK && errno != ENOTTY)
         syswarn("%s cant nonblock %d", LogName, fd);
 #endif
 

Modified: innd/icd.c
===================================================================
--- innd/icd.c	2014-08-28 18:59:18 UTC (rev 9658)
+++ innd/icd.c	2014-08-30 08:08:11 UTC (rev 9659)
@@ -8,6 +8,7 @@
 #include "portable/mmap.h"
 #include <sys/uio.h>
 
+#include "inn/fdflag.h"
 #include "inn/innconf.h"
 #include "inn/mmap.h"
 #include "innd.h"
@@ -453,7 +454,7 @@
 	syslog(L_FATAL, "%s cant open %s %m", LogName, ICDactpath);
 	exit(1);
     }
-    close_on_exec(ICDactfd, true);
+    fdflag_close_exec(ICDactfd, true);
 
 #ifdef HAVE_MMAP
 

Modified: innd/rc.c
===================================================================
--- innd/rc.c	2014-08-28 18:59:18 UTC (rev 9658)
+++ innd/rc.c	2014-08-30 08:08:11 UTC (rev 9659)
@@ -11,6 +11,7 @@
 #include <errno.h>
 #include <netdb.h>
 
+#include "inn/fdflag.h"
 #include "inn/innconf.h"
 #include "inn/network.h"
 #include "inn/vector.h"
@@ -381,7 +382,7 @@
         syslog(L_ERROR, "fd %d cant setsockopt(KEEPALIVE) %m", fd);
 #endif /* defined(SOL_SOCKET) && defined(SO_KEEPALIVE) */
 
-    if (nonblocking(fd, false) < 0)
+    if (!fdflag_nonblocking(fd, false))
 	syslog(L_ERROR, "%s cant nonblock %d in RChandoff %m", LogName, fd);
     switch (h) {
     default:

Modified: innd/site.c
===================================================================
--- innd/site.c	2014-08-28 18:59:18 UTC (rev 9658)
+++ innd/site.c	2014-08-30 08:08:11 UTC (rev 9659)
@@ -7,6 +7,7 @@
 #include "config.h"
 #include "clibrary.h"
 
+#include "inn/fdflag.h"
 #include "inn/innconf.h"
 #include "innd.h"
 
@@ -601,7 +602,7 @@
 	return false;
     }
 #endif
-    close_on_exec(pan[PIPE_WRITE], true);
+    fdflag_close_exec(pan[PIPE_WRITE], true);
 
     /* Set up the argument vector. */
     process = xstrdup(sp->Param);

Modified: innd/util.c
===================================================================
--- innd/util.c	2014-08-28 18:59:18 UTC (rev 9658)
+++ innd/util.c	2014-08-30 08:08:11 UTC (rev 9659)
@@ -6,6 +6,7 @@
 #include "config.h"
 #include "clibrary.h"
 
+#include "inn/fdflag.h"
 #include "inn/innconf.h"
 #include "inn/libinn.h"
 
@@ -236,9 +237,9 @@
         if (close(fd2) < 0)
             syslog(L_ERROR, NOCLOSE, LogName, fd2, av[0]);
     }
-    close_on_exec(0, false);
-    close_on_exec(1, false);
-    close_on_exec(2, false);
+    fdflag_close_exec(0, false);
+    fdflag_close_exec(1, false);
+    fdflag_close_exec(2, false);
 
     /* Nice our child if we're supposed to. */
     if (niceval != 0 && nice(niceval) == -1)

Modified: innfeed/Makefile
===================================================================
--- innfeed/Makefile	2014-08-28 18:59:18 UTC (rev 9658)
+++ innfeed/Makefile	2014-08-30 08:08:11 UTC (rev 9659)
@@ -122,10 +122,10 @@
   ../include/inn/defines.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h ../include/portable/socket.h \
   ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
-  ../include/portable/time.h ../include/inn/innconf.h \
-  ../include/inn/messages.h ../include/inn/network.h \
-  ../include/inn/libinn.h article.h misc.h buffer.h configfile.h \
-  connection.h endpoint.h host.h
+  ../include/portable/time.h ../include/inn/fdflag.h \
+  ../include/inn/innconf.h ../include/inn/messages.h \
+  ../include/inn/network.h ../include/inn/libinn.h article.h misc.h \
+  buffer.h configfile.h connection.h endpoint.h host.h
 endpoint.o: endpoint.c innfeed.h ../include/inn/timer.h \
   ../include/inn/defines.h ../include/inn/system.h ../include/config.h \
   ../include/inn/defines.h ../include/inn/options.h ../include/clibrary.h \

Modified: innfeed/connection.c
===================================================================
--- innfeed/connection.c	2014-08-28 18:59:18 UTC (rev 9658)
+++ innfeed/connection.c	2014-08-30 08:08:11 UTC (rev 9659)
@@ -64,6 +64,7 @@
 # include <sys/ioctl.h>
 #endif
 
+#include "inn/fdflag.h"
 #include "inn/innconf.h"
 #include "inn/messages.h"
 #include "inn/network.h"
@@ -537,7 +538,7 @@
       return false ;
     }
 
-  if (nonblocking (fd, true) < 0)
+  if (!fdflag_nonblocking (fd, true))
     {
       syswarn ("%s:%d cxnsleep can't set socket non-blocking", peerName,
                cxn->ident) ;

Modified: lib/Makefile
===================================================================
--- lib/Makefile	2014-08-28 18:59:18 UTC (rev 9658)
+++ lib/Makefile	2014-08-30 08:08:11 UTC (rev 9659)
@@ -16,7 +16,7 @@
 # The base library files that are always compiled and included.
 SOURCES       = argparse.c buffer.c cleanfrom.c clientactive.c clientlib.c \
 	      	commands.c concat.c conffile.c confparse.c daemonize.c	   \
-	      	date.c dbz.c defdist.c dispatch.c fdflags.c fdlimit.c	   \
+	      	date.c dbz.c defdist.c dispatch.c fdflag.c fdlimit.c	   \
 	      	getfqdn.c getmodaddr.c hash.c hashtab.c headers.c hex.c	   \
 	      	innconf.c inndcomm.c list.c localopen.c lockfile.c	   \
 	      	makedir.c md5.c messageid.c messages.c mmap.c network.c	   \
@@ -138,8 +138,10 @@
 dbz.o: dbz.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h ../include/portable/mmap.h ../include/inn/dbz.h \
-  ../include/inn/libinn.h ../include/inn/defines.h \
-  ../include/inn/messages.h ../include/inn/innconf.h ../include/inn/mmap.h
+  ../include/inn/libinn.h ../include/inn/defines.h ../include/inn/fdflag.h \
+  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
+  ../include/portable/getnameinfo.h ../include/inn/messages.h \
+  ../include/inn/innconf.h ../include/inn/mmap.h
 defdist.o: defdist.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h ../include/inn/innconf.h ../include/inn/defines.h \
@@ -148,9 +150,11 @@
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h ../include/inn/dispatch.h ../include/inn/vector.h \
   ../include/inn/defines.h
-fdflags.o: fdflags.c ../include/config.h ../include/inn/defines.h \
+fdflag.o: fdflag.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
-  ../include/config.h ../include/inn/libinn.h ../include/inn/defines.h
+  ../include/config.h ../include/inn/fdflag.h ../include/inn/defines.h \
+  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
+  ../include/portable/getnameinfo.h ../include/inn/libinn.h
 fdlimit.o: fdlimit.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h ../include/inn/libinn.h ../include/inn/defines.h

Modified: lib/dbz.c
===================================================================
--- lib/dbz.c	2014-08-28 18:59:18 UTC (rev 9658)
+++ lib/dbz.c	2014-08-30 08:08:11 UTC (rev 9659)
@@ -78,6 +78,7 @@
 #include <sys/time.h>
 
 #include "inn/dbz.h"
+#include "inn/fdflag.h"
 #include "inn/messages.h"
 #include "inn/innconf.h"
 #include "inn/mmap.h"
@@ -670,7 +671,7 @@
     free(name);
 
     tab->reclen = reclen;
-    close_on_exec(tab->fd, true);
+    fdflag_close_exec(tab->fd, true);
     tab->pos = -1;
 
     /* get first table into core, if it looks desirable and feasible */
@@ -685,7 +686,7 @@
 	}
     }
 
-    if (options.nonblock && nonblocking(tab->fd, true) < 0) {
+    if (options.nonblock && !fdflag_nonblocking(tab->fd, true)) {
 	syswarn("fcntl: could not set nonblock");
         oerrno = errno;
 	close(tab->fd);
@@ -721,7 +722,7 @@
     } else
 	basefname = NULL;
     if (basef != NULL)
-	close_on_exec(fileno(basef), true);
+	fdflag_close_exec(fileno(basef), true);
     if (basef != NULL)
 	 setvbuf(basef, NULL, _IOFBF, 64);
     return true;
@@ -758,7 +759,7 @@
 	syswarn("dbzinit: can't open .dir file");
 	return false;
     }
-    close_on_exec(fileno(dirf), true);
+    fdflag_close_exec(fileno(dirf), true);
 
     /* pick up configuration */
     if (!getconf(dirf, &conf)) {
@@ -1313,14 +1314,14 @@
     if (tab->incore == INCORE_MEM) {
 	if(options.writethrough)
 	    return true;
-	nonblocking(tab->fd, false);
+	fdflag_nonblocking(tab->fd, false);
 	size = tab->reclen * conf.tsize;
         result = xpwrite(tab->fd, tab->core, size, 0);
 	if (result < 0 || (size_t) result != size) {
-	    nonblocking(tab->fd, options.nonblock);
+	    fdflag_nonblocking(tab->fd, options.nonblock);
 	    return false;
 	}
-	nonblocking(tab->fd, options.nonblock);
+	fdflag_nonblocking(tab->fd, options.nonblock);
     }
 #ifdef HAVE_MMAP
     if(tab->incore == INCORE_MMAP) {

Copied: trunk/lib/fdflag.c (from rev 9649, trunk/lib/fdflags.c)
===================================================================
--- lib/fdflag.c	                        (rev 0)
+++ lib/fdflag.c	2014-08-30 08:08:11 UTC (rev 9659)
@@ -0,0 +1,151 @@
+/* $Id$
+ *
+ * Set or clear file descriptor flags.
+ *
+ * Simple functions (wrappers around fcntl) to set or clear file descriptor
+ * flags like close-on-exec or nonblocking I/O.
+ *
+ * The canonical version of this file is maintained in the rra-c-util package,
+ * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+ *
+ * Copyright 2008, 2011, 2013
+ *     The Board of Trustees of the Leland Stanford Junior University
+ * Copyright (c) 2004, 2005, 2006
+ *     by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+ *     2002, 2003 by The Internet Software Consortium and Rich Salz
+ *
+ * This code is derived from software contributed to the Internet Software
+ * Consortium by Rich Salz.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "config.h"
+#include "clibrary.h"
+#include <errno.h>
+
+#include "inn/fdflag.h"
+#include "inn/libinn.h"
+
+#ifdef _WIN32
+# include <winsock2.h>
+#else
+# include <fcntl.h>
+# ifndef O_NONBLOCK
+#  include <sys/ioctl.h>
+#  if HAVE_SYS_FILIO_H
+#   include <sys/filio.h>
+#  endif
+# endif
+#endif
+
+
+/*
+ * Set a file to close-on-exec (or clear that setting if the flag is false),
+ * returning true on success and false on failure.
+ *
+ * One is supposed to retrieve the flags, add FD_CLOEXEC, and then set them,
+ * although I've never seen a system with any flags other than close-on-exec.
+ * Do it right anyway; it's not that expensive.
+ *
+ * Stub this out on Windows, where it's not supported (at least currently by
+ * this utility library).
+ */
+#ifdef _WIN32
+bool
+fdflag_close_exec(int fd UNUSED, bool flag UNUSED)
+{
+    return false;
+}
+#else
+bool
+fdflag_close_exec(int fd, bool flag)
+{
+    int oflag, mode;
+
+    oflag = fcntl(fd, F_GETFD, 0);
+    if (oflag < 0)
+        return false;
+    mode = flag ? (oflag | FD_CLOEXEC) : (oflag & ~FD_CLOEXEC);
+    return (fcntl(fd, F_SETFD, mode) == 0);
+}
+#endif
+
+
+/*
+ * Set a file descriptor to nonblocking (or clear the nonblocking flag if flag
+ * is false), returning true on success and false on failure.
+ *
+ * For Windows, be aware that this will only work for sockets.  For UNIX, you
+ * can pass a non-socket in and it will do the right thing, since UNIX doesn't
+ * distinguish, but Windows will not allow that.  Thankfully, there's rarely
+ * any need to set non-sockets non-blocking.
+ *
+ * For UNIX, always use O_NONBLOCK; O_NDELAY is not the same thing
+ * historically.  The semantics of O_NDELAY are that if the read would block,
+ * it returns 0 instead.  This is indistinguishable from an end of file
+ * condition.  POSIX added O_NONBLOCK, which requires read to return -1 and
+ * set errno to EAGAIN, which is what we want.
+ *
+ * FNDELAY (4.3BSD) originally did the correct thing, although it has a
+ * different incompatibility (affecting all users of a socket rather than just
+ * a file descriptor and returning EWOULDBLOCK instead of EAGAIN) that we
+ * probably don't care about.  Using it is probably safe, but BSD should also
+ * have the ioctl, and at least on Solaris FNDELAY does the same thing as
+ * O_NDELAY, not O_NONBLOCK.  So if we don't have O_NONBLOCK, fall back to the
+ * ioctl instead.
+ *
+ * Reference:  Stevens, Advanced Unix Programming, pg. 364.
+ *
+ * Note that O_NONBLOCK is known not to work on earlier versions of ULTRIX,
+ * SunOS, and AIX, possibly not setting the socket nonblocking at all, despite
+ * the fact that they do define it.  It works in later SunOS and, current AIX,
+ * however, and a 1999-10-25 survey of current operating systems failed to
+ * turn up any that didn't handle it correctly (as required by POSIX), while
+ * HP-UX 11.00 did use the broken return-zero semantics of O_NDELAY (most
+ * other operating systems surveyed treated O_NDELAY as synonymous with
+ * O_NONBLOCK).  Accordingly, we currently unconditionally use O_NONBLOCK.  If
+ * this causes too many problems, an autoconf test may be required.
+ */
+#if defined(_WIN32)
+bool
+fdflag_nonblocking(socket_type fd, bool flag)
+{
+    u_long mode;
+
+    mode = flag ? 1 : 0;
+    return (ioctlsocket(fd, FIONBIO, &mode) == 0);
+}
+#elif defined(O_NONBLOCK)
+bool
+fdflag_nonblocking(socket_type fd, bool flag)
+{
+    int mode;
+
+    mode = fcntl(fd, F_GETFL, 0);
+    if (mode < 0)
+        return false;
+    mode = (flag ? (mode | O_NONBLOCK) : (mode & ~O_NONBLOCK));
+    return (fcntl(fd, F_SETFL, mode) == 0);
+}
+#else /* !O_NONBLOCK */
+bool
+fdflag_nonblocking(socket_type fd, bool flag)
+{
+    int state;
+
+    state = flag ? 1 : 0;
+    return (ioctl(fd, FIONBIO, &state) == 0);
+}
+#endif /* !O_NONBLOCK */

Deleted: lib/fdflags.c
===================================================================
--- lib/fdflags.c	2014-08-28 18:59:18 UTC (rev 9658)
+++ lib/fdflags.c	2014-08-30 08:08:11 UTC (rev 9659)
@@ -1,103 +0,0 @@
-/*  $Id$
-**
-**  Set or clear file descriptor flags.
-**
-**  Simple functions (wrappers around fcntl) to set or clear file descriptor
-**  flags like close on exec or nonblocking I/O.
-*/
-
-#include "config.h"
-#include "clibrary.h"
-#include "inn/libinn.h"
-#include <errno.h>
-#include <fcntl.h>
-
-/*
-**  Set a file to close on exec (or clear that setting if the flag is false).
-**
-**  One is supposed to retrieve the flags, add FD_CLOEXEC, and then set
-**  them, although I've never seen a system with any flags other than
-**  close-on-exec.  Do it right anyway; it's not that expensive.  Avoid
-**  changing errno.  Errors are ignored, since it generally doesn't cause
-**  significant harm to fail.
-*/
-void
-close_on_exec(int fd, bool flag)
-{
-    int oerrno;
-    int oflag;
-
-    oerrno = errno;
-    oflag = fcntl(fd, F_GETFD, 0);
-    if (oflag < 0) {
-        errno = oerrno;
-        return;
-    }
-    fcntl(fd, F_SETFD, flag ? (oflag | FD_CLOEXEC) : (oflag & ~FD_CLOEXEC));
-    errno = oerrno;
-}
-
-
-/*
-**  Set a file descriptor to nonblocking (or clear the nonblocking flag if
-**  flag is false).
-**
-**  Always use O_NONBLOCK; O_NDELAY is *not* the same thing historically.
-**  The semantics of O_NDELAY are that if the read would block, it returns 0
-**  instead.  This is indistinguishable from an end of file condition.
-**  POSIX added O_NONBLOCK, which requires read to return -1 and set errno
-**  to EAGAIN, which is what we want.
-**
-**  FNDELAY (4.3BSD) originally did the correct thing, although it has a
-**  different incompatibility (affecting all users of a socket rather than
-**  just a file descriptor and returning EWOULDBLOCK instead of EAGAIN) that
-**  we don't care about in INN.  Using it is *probably* safe, but BSD should
-**  also have the ioctl, and at least on Solaris FNDELAY does the same thing
-**  as O_NDELAY, not O_NONBLOCK.  So if we don't have O_NONBLOCK, fall back
-**  to the ioctl instead.
-**
-**  Reference:  Stevens, Advanced Unix Programming, pg. 364.
-**
-**  Note that O_NONBLOCK is known not to work on earlier versions of ULTRIX,
-**  SunOS, and AIX, possibly not setting the socket nonblocking at all,
-**  despite the fact that they do define it.  It works in later SunOS and,
-**  current AIX, however, and a 1999-10-25 survey of current operating
-**  systems failed to turn up any that didn't handle it correctly (as
-**  required by POSIX), while HP-UX 11.00 did use the broken return-zero
-**  semantics of O_NDELAY (most other operating systems surveyed treated
-**  O_NDELAY as synonymous with O_NONBLOCK).  Accordingly, we currently
-**  unconditionally use O_NONBLOCK.  If this causes too many problems, an
-**  autoconf test may be required.
-*/
-
-#ifdef O_NONBLOCK
-
-int
-nonblocking(int fd, bool flag)
-{
-    int mode;
-
-    mode = fcntl(fd, F_GETFL, 0);
-    if (mode < 0)
-        return -1;
-    mode = (flag ? (mode | O_NONBLOCK) : (mode & ~O_NONBLOCK));
-    return fcntl(fd, F_SETFL, mode);
-}
-
-#else /* !O_NONBLOCK */
-
-#include <sys/ioctl.h>
-#if HAVE_SYS_FILIO_H
-# include <sys/filio.h>
-#endif
-
-int
-nonblocking(int fd, bool flag)
-{
-    int state;
-
-    state = flag ? 1 : 0;
-    return ioctl(fd, FIONBIO, &state);
-}
-
-#endif /* !O_NONBLOCK */

Modified: nnrpd/Makefile
===================================================================
--- nnrpd/Makefile	2014-08-28 18:59:18 UTC (rev 9658)
+++ nnrpd/Makefile	2014-08-30 08:08:11 UTC (rev 9659)
@@ -110,9 +110,9 @@
   ../include/inn/qio.h ../include/inn/defines.h ../include/inn/libinn.h \
   ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
   ../include/inn/options.h ../include/inn/vector.h ../include/inn/timer.h \
-  ../include/inn/ov.h ../include/inn/storage.h ../include/inn/history.h \
-  ../include/inn/innconf.h ../include/inn/messages.h \
-  ../include/inn/version.h tls.h
+  ../include/inn/fdflag.h ../include/inn/ov.h ../include/inn/storage.h \
+  ../include/inn/history.h ../include/inn/innconf.h \
+  ../include/inn/messages.h ../include/inn/version.h tls.h
 line.o: line.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h ../include/inn/messages.h ../include/inn/defines.h \

Modified: nnrpd/commands.c
===================================================================
--- nnrpd/commands.c	2014-08-28 18:59:18 UTC (rev 9658)
+++ nnrpd/commands.c	2014-08-30 08:08:11 UTC (rev 9659)
@@ -7,6 +7,7 @@
 #include "portable/wait.h"
 
 #include "nnrpd.h"
+#include "inn/fdflag.h"
 #include "inn/ov.h"
 #include "inn/innconf.h"
 #include "inn/messages.h"
@@ -183,9 +184,9 @@
 	    close(pan[PIPE_WRITE]);
 	}
 
-	close_on_exec(STDIN_FILENO, false);
-	close_on_exec(STDOUT_FILENO, false);
-	close_on_exec(STDERR_FILENO, false);
+	fdflag_close_exec(STDIN_FILENO, false);
+	fdflag_close_exec(STDOUT_FILENO, false);
+	fdflag_close_exec(STDERR_FILENO, false);
 
 	execv(path, av);
         /* RFC 2980 requires 500 if there are unspecified errors during

Modified: storage/Makefile
===================================================================
--- storage/Makefile	2014-08-28 18:59:18 UTC (rev 9658)
+++ storage/Makefile	2014-08-30 08:08:11 UTC (rev 9659)
@@ -157,7 +157,9 @@
   ../include/inn/defines.h ../include/inn/messages.h \
   ../include/inn/libinn.h ../include/inn/ov.h ../include/inn/storage.h \
   ../include/inn/options.h ../include/inn/history.h ../include/inn/paths.h \
-  ovinterface.h ../include/inn/storage.h buffindexed/shmem.h \
+  ovinterface.h ../include/inn/storage.h ../include/inn/fdflag.h \
+  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
+  ../include/portable/getnameinfo.h buffindexed/shmem.h \
   buffindexed/buffindexed.h
 buffindexed/shmem.o: buffindexed/shmem.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
@@ -166,8 +168,10 @@
 cnfs/cnfs.o: cnfs/cnfs.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h ../include/portable/mmap.h \
-  ../include/portable/time.h ../include/inn/innconf.h \
-  ../include/inn/defines.h ../include/inn/messages.h ../include/inn/mmap.h \
+  ../include/portable/time.h ../include/inn/fdflag.h \
+  ../include/inn/defines.h ../include/portable/socket.h \
+  ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
+  ../include/inn/innconf.h ../include/inn/messages.h ../include/inn/mmap.h \
   ../include/inn/wire.h interface.h ../include/inn/storage.h \
   ../include/inn/options.h ../include/inn/libinn.h methods.h interface.h \
   ../include/inn/paths.h cnfs/cnfs.h cnfs/cnfs-private.h
@@ -175,8 +179,8 @@
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h ../include/portable/socket.h \
   ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
-  ../include/portable/time.h ../include/conffile.h \
-  ../include/inn/innconf.h ../include/inn/defines.h \
+  ../include/portable/time.h ../include/conffile.h ../include/inn/fdflag.h \
+  ../include/inn/defines.h ../include/inn/innconf.h \
   ../include/inn/libinn.h ../include/inn/messages.h \
   ../include/inn/newsuser.h ../include/inn/paths.h \
   ../include/inn/storage.h ../include/inn/options.h ../include/inn/ov.h \
@@ -189,7 +193,9 @@
 timecaf/timecaf.o: timecaf/timecaf.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h ../include/portable/mmap.h timecaf/caf.h \
-  ../include/inn/innconf.h ../include/inn/defines.h \
+  ../include/inn/fdflag.h ../include/inn/defines.h \
+  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
+  ../include/portable/getnameinfo.h ../include/inn/innconf.h \
   ../include/inn/messages.h ../include/inn/wire.h ../include/inn/libinn.h \
   methods.h interface.h ../include/inn/storage.h ../include/inn/options.h \
   timecaf/timecaf.h interface.h ../include/inn/paths.h
@@ -211,8 +217,10 @@
 tradindexed/tdx-data.o: tradindexed/tdx-data.c ../include/config.h \
   ../include/inn/defines.h ../include/inn/system.h \
   ../include/inn/options.h ../include/clibrary.h ../include/config.h \
-  ../include/portable/mmap.h ../include/inn/history.h \
-  ../include/inn/defines.h ../include/inn/innconf.h \
+  ../include/portable/mmap.h ../include/inn/fdflag.h \
+  ../include/inn/defines.h ../include/portable/socket.h \
+  ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
+  ../include/inn/history.h ../include/inn/innconf.h \
   ../include/inn/messages.h ../include/inn/mmap.h ../include/inn/libinn.h \
   ../include/inn/ov.h ../include/inn/storage.h ../include/inn/options.h \
   ovinterface.h ../include/inn/storage.h tradindexed/tdx-private.h \
@@ -220,8 +228,10 @@
 tradindexed/tdx-group.o: tradindexed/tdx-group.c ../include/config.h \
   ../include/inn/defines.h ../include/inn/system.h \
   ../include/inn/options.h ../include/clibrary.h ../include/config.h \
-  ../include/portable/mmap.h ../include/inn/hashtab.h \
-  ../include/inn/defines.h ../include/inn/innconf.h \
+  ../include/portable/mmap.h ../include/inn/fdflag.h \
+  ../include/inn/defines.h ../include/portable/socket.h \
+  ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
+  ../include/inn/hashtab.h ../include/inn/innconf.h \
   ../include/inn/messages.h ../include/inn/mmap.h ../include/inn/qio.h \
   ../include/inn/vector.h ../include/inn/libinn.h ../include/inn/paths.h \
   tradindexed/tdx-private.h ../include/inn/storage.h \

Modified: storage/buffindexed/buffindexed.c
===================================================================
--- storage/buffindexed/buffindexed.c	2014-08-28 18:59:18 UTC (rev 9658)
+++ storage/buffindexed/buffindexed.c	2014-08-30 08:08:11 UTC (rev 9659)
@@ -36,6 +36,7 @@
 #include "inn/paths.h"
 #include "ovinterface.h"
 #include "inn/storage.h"
+#include "inn/fdflag.h"
 
 /* Yes. I know that it violates INN coding style. However, this allows
  * me to compile this new version without reconfiguring INN.
@@ -610,7 +611,7 @@
 	syswarn("buffindexed: ERROR opening '%s'", ovbuff->path);
 	return false;
       } else {
-	close_on_exec(fd, true);
+	fdflag_close_exec(fd, true);
 	ovbuff->fd = fd;
       }
     }
@@ -1056,7 +1057,7 @@
       return false;
     }
   }
-  close_on_exec(GROUPfd, true);
+  fdflag_close_exec(GROUPfd, true);
 
   free(groupfn);
   Cutofflow = false;

Modified: storage/cnfs/cnfs.c
===================================================================
--- storage/cnfs/cnfs.c	2014-08-28 18:59:18 UTC (rev 9658)
+++ storage/cnfs/cnfs.c	2014-08-30 08:08:11 UTC (rev 9659)
@@ -17,6 +17,7 @@
 #include <sys/stat.h>
 #include <sys/uio.h>
 
+#include "inn/fdflag.h"
 #include "inn/innconf.h"
 #include "inn/messages.h"
 #include "inn/mmap.h"
@@ -596,7 +597,7 @@
             syswarn("CNFS: ERROR opening '%s' O_RDONLY", cycbuff->path);
 	    return false;
 	} else {
-	    close_on_exec(fd, true);
+	    fdflag_close_exec(fd, true);
 	    cycbuff->fd = fd;
 	}
     }

Modified: storage/ovdb/ovdb.c
===================================================================
--- storage/ovdb/ovdb.c	2014-08-28 18:59:18 UTC (rev 9658)
+++ storage/ovdb/ovdb.c	2014-08-30 08:08:11 UTC (rev 9659)
@@ -90,6 +90,7 @@
 #endif
 
 #include "conffile.h"
+#include "inn/fdflag.h"
 #include "inn/innconf.h"
 #include "inn/libinn.h"
 #include "inn/messages.h"
@@ -1265,7 +1266,7 @@
                      " running");
 	    return false;
 	}
-	close_on_exec(lockfd, true);
+	fdflag_close_exec(lockfd, true);
 	free(lockfn);
     } else
 	return true;

Modified: storage/timecaf/timecaf.c
===================================================================
--- storage/timecaf/timecaf.c	2014-08-28 18:59:18 UTC (rev 9658)
+++ storage/timecaf/timecaf.c	2014-08-30 08:08:11 UTC (rev 9659)
@@ -15,6 +15,7 @@
 #include <time.h>
 
 #include "caf.h"
+#include "inn/fdflag.h"
 #include "inn/innconf.h"
 #include "inn/messages.h"
 #include "inn/wire.h"
@@ -433,7 +434,7 @@
     }
     WritingFile.fd = fd;
     WritingFile.path = path;
-    close_on_exec(fd, true);
+    fdflag_close_exec(fd, true);
     result = xwritev(fd, article.iov, article.iovcnt);
     if (result != (ssize_t) article.len) {
 	SMseterror(SMERR_UNDEFINED, NULL);

Modified: storage/tradindexed/tdx-data.c
===================================================================
--- storage/tradindexed/tdx-data.c	2014-08-28 18:59:18 UTC (rev 9658)
+++ storage/tradindexed/tdx-data.c	2014-08-30 08:08:11 UTC (rev 9659)
@@ -22,6 +22,7 @@
 #include <fcntl.h>
 #include <sys/stat.h>
 
+#include "inn/fdflag.h"
 #include "inn/history.h"
 #include "inn/innconf.h"
 #include "inn/messages.h"
@@ -179,7 +180,7 @@
         return false;
     }
     data->indexinode = st.st_ino;
-    close_on_exec(data->indexfd, true);
+    fdflag_close_exec(data->indexfd, true);
     return true;
 }
 
@@ -198,7 +199,7 @@
     data->datafd = file_open(data->path, suffix, data->writable, true);
     if (data->datafd < 0)
         return false;
-    close_on_exec(data->datafd, true);
+    fdflag_close_exec(data->datafd, true);
     return true;
 }
 

Modified: storage/tradindexed/tdx-group.c
===================================================================
--- storage/tradindexed/tdx-group.c	2014-08-28 18:59:18 UTC (rev 9658)
+++ storage/tradindexed/tdx-group.c	2014-08-30 08:08:11 UTC (rev 9659)
@@ -90,6 +90,7 @@
 #include <sys/stat.h>
 #include <time.h>
 
+#include "inn/fdflag.h"
 #include "inn/hashtab.h"
 #include "inn/innconf.h"
 #include "inn/messages.h"
@@ -263,7 +264,7 @@
         syswarn("tradindexed: cannot fstat %s", index->path);
         goto fail;
     }
-    close_on_exec(index->fd, true);
+    fdflag_close_exec(index->fd, true);
     return true;
 
  fail:



More information about the inn-committers mailing list