# arch-tag: automatic-ChangeLog--srvx@srvx.net--2006/srvx--devo--1.3
#
+2006-10-21 16:06:47 GMT Michael Poole <mdpoole@troilus.org> patch-60
+
+ Summary:
+ Various I/O cleanups and fixes.
+ Revision:
+ srvx--devo--1.3--patch-60
+
+ src/ioset.c (ioset_add): Set FD_CLOEXEC flag on all managed sockets.
+ (ioset_try_write): Tidy formatting.
+ (ioset_close): Add another bit to "os_close".
+
+ src/proto-common.c (close_socket): Pass the new bit to ioset_close().
+
+ modified files:
+ ChangeLog src/ioset.c src/proto-common.c
+
+
2006-10-21 16:04:19 GMT Michael Poole <mdpoole@troilus.org> patch-59
Summary:
ioq_init(&res->recv, 1024);
flags = fcntl(fd, F_GETFL);
fcntl(fd, F_SETFL, flags|O_NONBLOCK);
+ flags = fcntl(fd, F_GETFD);
+ fcntl(fd, F_SETFD, flags|FD_CLOEXEC);
engine->add(res);
return res;
}
static void
ioset_try_write(struct io_fd *fd) {
int res;
- unsigned int req = ioq_get_avail(&fd->send);
+ unsigned int req;
+
+ req = ioq_get_avail(&fd->send);
res = write(fd->fd, fd->send.buf+fd->send.get, req);
if (res < 0) {
switch (errno) {
active_fd = NULL;
if (fdp->destroy_cb)
fdp->destroy_cb(fdp);
- if (fdp->send.get != fdp->send.put) {
+ if (fdp->send.get != fdp->send.put && (os_close & 2)) {
int flags;
flags = fcntl(fdp->fd, F_GETFL);
}
free(fdp->send.buf);
free(fdp->recv.buf);
- if (os_close)
+ if (os_close & 1)
close(fdp->fd);
engine->remove(fdp);
free(fdp);
replay_connected = 0;
socket_destroyed(socket_io_fd);
} else {
- ioset_close(socket_io_fd, 1);
+ ioset_close(socket_io_fd, 3);
socket_io_fd = NULL;
}
}