diff options
author | Jorge Arellano Cid <jcid@dillo.org> | 2013-01-09 12:47:23 -0300 |
---|---|---|
committer | Jorge Arellano Cid <jcid@dillo.org> | 2013-01-09 12:47:23 -0300 |
commit | cbba835b154ba31e7a07ba1b15a06b8953eb7e72 (patch) | |
tree | 8ea8ad0b67ba6a2f8a789f9e61ea4f80d0c20d35 /dpid/main.c | |
parent | d236210c1608952b7910123fbede108317a80444 (diff) |
Refactored FD close calls into a single new dClose() dlib function [p37sitdu]
Diffstat (limited to 'dpid/main.c')
-rw-r--r-- | dpid/main.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/dpid/main.c b/dpid/main.c index 5f512245..6350a2b6 100644 --- a/dpid/main.c +++ b/dpid/main.c @@ -26,6 +26,8 @@ #include "dpi.h" #include "dpi_socket_dir.h" #include "misc_new.h" + +#include "../dlib/dlib.h" #include "../dpip/dpip.h" sigset_t mask_sigchld; @@ -76,13 +78,13 @@ static int start_filter_plugin(struct dp dpi_attr) } /* Parent, Close sockets fix stdio and return pid */ - if (a_Misc_close_fd(newsock) == -1) { + if (dClose(newsock) == -1) { ERRMSG("start_plugin", "close", errno); MSG_ERR("ERROR in child proc for %s\n", dpi_attr.path); exit(1); } - a_Misc_close_fd(STDIN_FILENO); - a_Misc_close_fd(STDOUT_FILENO); + dClose(STDIN_FILENO); + dClose(STDOUT_FILENO); dup2(old_stdin, STDIN_FILENO); dup2(old_stdout, STDOUT_FILENO); return pid; @@ -95,7 +97,7 @@ static void start_server_plugin(struct dp dpi_attr) MSG_ERR("ERROR in child proc for %s\n", dpi_attr.path); exit(1); } - if (a_Misc_close_fd(dpi_attr.sock_fd) == -1) { + if (dClose(dpi_attr.sock_fd) == -1) { ERRMSG("start_plugin", "close", errno); MSG_ERR("ERROR in child proc for %s\n", dpi_attr.path); exit(1); @@ -224,7 +226,7 @@ int main(void) /* close inherited file descriptors */ open_max = get_open_max(); for (i = 3; i < open_max; i++) - a_Misc_close_fd(i); + dClose(i); /* this sleep used to unmask a race condition */ // sleep(2); |