/*
- * $Id: comm.cc,v 1.60 1996/08/28 20:11:49 wessels Exp $
+ * $Id: comm.cc,v 1.61 1996/08/30 22:36:21 wessels Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
fd_note(new_socket, note);
conn->openned = 1;
- if (!(io_type & COMM_NOCLOEXEC)) {
- if (fcntl(new_socket, F_SETFD, 1) < 0) {
- debug(5, 0, "comm_open: FD %d: set close-on-exec failed: %s\n",
- new_socket, xstrerror());
- }
- }
+ if (!(io_type & COMM_NOCLOEXEC))
+ commSetCloseOnExec(new_socket);
if (port > 0) {
commSetNoLinger(new_socket);
if (do_reuse)
getsockname(sock, (struct sockaddr *) &M, &Slen);
*me = M;
}
+ commSetCloseOnExec(sock);
/* fdstat update */
fdstat_open(sock, FD_SOCKET);
conn = &fd_table[sock];
fd, size, xstrerror());
}
-
int commSetNonBlocking(fd)
int fd;
{
return 0;
}
+void commSetCloseOnExec(fd)
+ int fd;
+{
+#ifdef FD_CLOEXEC
+ if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) {
+ debug(5, 0, "comm_open: FD %d: set close-on-exec failed: %s\n",
+ fd, xstrerror());
+ }
+#endif
+}
+
char **getAddressList(name)
char *name;
{
/*
- * $Id: disk.cc,v 1.21 1996/08/19 22:46:26 wessels Exp $
+ * $Id: disk.cc,v 1.22 1996/08/30 22:36:28 wessels Exp $
*
* DEBUG: section 6 Disk I/O Routines
* AUTHOR: Harvest Derived
}
/* update fdstat */
fdstat_open(fd, FD_FILE);
+ commSetCloseOnExec(fd);
/* init table */
strncpy(file_table[fd].filename, path, MAX_FILE_NAME_LEN);