mirror of https://github.com/BOINC/boinc.git
- client, Unix: make Curl sockets close-on-exec,
so that app processes don't inherit them. - client: fix bug that makes client exit if a slot dir contains finish file on startup
This commit is contained in:
parent
0f5fcca435
commit
c8bc624553
|
@ -6428,3 +6428,13 @@ David 28 Oct 2012
|
|||
client/
|
||||
app.cpp
|
||||
app_control.cpp
|
||||
|
||||
David 28 Oct 2012
|
||||
- client, Unix: make Curl sockets close-on-exec,
|
||||
so that app processes don't inherit them.
|
||||
- client: fix bug that makes client exit if a slot dir contains
|
||||
finish file on startup
|
||||
|
||||
client/
|
||||
app_control.cpp
|
||||
http_curl.cpp
|
||||
|
|
|
@ -129,6 +129,7 @@ bool ACTIVE_TASK_SET::poll() {
|
|||
last_finish_check_time = gstate.now;
|
||||
for (i=0; i<active_tasks.size(); i++) {
|
||||
ACTIVE_TASK* atp = active_tasks[i];
|
||||
if (atp->task_state() == PROCESS_UNINITIALIZED) continue;
|
||||
if (atp->finish_file_time) {
|
||||
atp->kill_task(false);
|
||||
} else if (atp->finish_file_present()) {
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <cerrno>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#if HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
@ -387,6 +388,14 @@ bool HTTP_OP::no_proxy_for_url(const char* url) {
|
|||
return false;
|
||||
}
|
||||
|
||||
static int set_cloexec(void*, curl_socket_t fd, curlsocktype purpose) {
|
||||
#ifndef _WIN32
|
||||
if (purpose != CURLSOCKTYPE_IPCXN) return 0;
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
// the following will do an HTTP GET or POST using libcurl
|
||||
//
|
||||
int HTTP_OP::libcurl_exec(
|
||||
|
@ -520,10 +529,16 @@ int HTTP_OP::libcurl_exec(
|
|||
// bypass any signal handlers that curl may want to install
|
||||
//
|
||||
curl_easy_setopt(curlEasy, CURLOPT_NOSIGNAL, 1L);
|
||||
|
||||
// bypass progress meter
|
||||
//
|
||||
curl_easy_setopt(curlEasy, CURLOPT_NOPROGRESS, 1L);
|
||||
|
||||
// arrange for a function to get called between socket() and connect()
|
||||
// so that we can mark the socket as close-on-exec
|
||||
//
|
||||
curl_easy_setopt(curlEasy, CURLOPT_SOCKOPTFUNCTION, set_cloexec);
|
||||
|
||||
// setup timeouts
|
||||
//
|
||||
curl_easy_setopt(curlEasy, CURLOPT_TIMEOUT, 0L);
|
||||
|
|
Loading…
Reference in New Issue