projects
/
paraslash.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix gcc warnings on shadowed declarations
[paraslash.git]
/
dccp_send.c
diff --git
a/dccp_send.c
b/dccp_send.c
index 9bfe65f68a7bc7634c5ba581589e95c96c434e18..aba21a6db1d2e92aa997a964a053d8000df9b2f1 100644
(file)
--- a/
dccp_send.c
+++ b/
dccp_send.c
@@
-31,8
+31,10
@@
#include "dccp.h"
#include "error.h"
#include "string.h"
#include "dccp.h"
#include "error.h"
#include "string.h"
+#include "fd.h"
+#include "close_on_fork.h"
#include "server.cmdline.h"
#include "server.cmdline.h"
-extern struct gengetopt_args_info conf;
+
/** the list of connected clients **/
static struct list_head clients;
static int listen_fd = -1;
/** the list of connected clients **/
static struct list_head clients;
static int listen_fd = -1;
@@
-75,6
+77,8
@@
static void dccp_post_select(fd_set *rfds, __a_unused fd_set *wfds)
PARA_NOTICE_LOG("connection from %s\n", inet_ntoa(dc->addr.sin_addr));
dc->fd = ret;
list_add(&dc->node, &clients);
PARA_NOTICE_LOG("connection from %s\n", inet_ntoa(dc->addr.sin_addr));
dc->fd = ret;
list_add(&dc->node, &clients);
+ add_close_on_fork_list(dc->fd);
+ mark_fd_nonblock(dc->fd);
}
static int dccp_open(void)
}
static int dccp_open(void)
@@
-101,6
+105,8
@@
static int dccp_open(void)
if (ret < 0)
return -E_DCCP_LISTEN;
PARA_DEBUG_LOG("listening on fd %d\n", listen_fd);
if (ret < 0)
return -E_DCCP_LISTEN;
PARA_DEBUG_LOG("listening on fd %d\n", listen_fd);
+ add_close_on_fork_list(listen_fd);
+ mark_fd_nonblock(listen_fd);
return 1;
}
return 1;
}
@@
-109,17
+115,18
@@
static void dccp_shutdown_client(struct dccp_client *dc)
PARA_DEBUG_LOG("shutting down %s (fd %d)\n", inet_ntoa(dc->addr.sin_addr),
dc->fd);
close(dc->fd);
PARA_DEBUG_LOG("shutting down %s (fd %d)\n", inet_ntoa(dc->addr.sin_addr),
dc->fd);
close(dc->fd);
+ del_close_on_fork_list(dc->fd);
list_del(&dc->node);
free(dc);
}
static int dccp_write(int fd, const char *buf, size_t len)
{
list_del(&dc->node);
free(dc);
}
static int dccp_write(int fd, const char *buf, size_t len)
{
- size_t s
end
, written = 0;
+ size_t s
ize
, written = 0;
int ret;
again:
int ret;
again:
- s
end
= PARA_MIN(1024, len - written);
- ret = write(fd, buf + written, s
end
);
+ s
ize
= PARA_MIN(1024, len - written);
+ ret = write(fd, buf + written, s
ize
);
if (ret < 0)
goto err_out;
written += ret;
if (ret < 0)
goto err_out;
written += ret;