Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2
curl
libcurl-ocloexec.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libcurl-ocloexec.patch of Package curl
Open library file descriptors with O_CLOEXEC This patch is non-portable, it needs linux 2.6.23 and glibc 2.7 or later, different combinations (old linux, new glibc and vice-versa) will result in a crash. To make it portable you have to test O_CLOEXEC support at *runtime* compile time is not enough. --- lib/cookie.c.orig +++ lib/cookie.c @@ -736,7 +736,7 @@ struct CookieInfo *Curl_cookie_init(stru fp = NULL; } else - fp = file?fopen(file, "r"):NULL; + fp = file?fopen(file, "re"):NULL; c->newsession = newsession; /* new session? */ @@ -1060,7 +1060,7 @@ static int cookie_output(struct CookieIn use_stdout=TRUE; } else { - out = fopen(dumphere, "w"); + out = fopen(dumphere, "we"); if(!out) return 1; /* failure */ } --- lib/file.c.orig +++ lib/file.c @@ -249,7 +249,7 @@ static CURLcode file_connect(struct conn fd = open_readonly(actual_path, O_RDONLY|O_BINARY); file->path = actual_path; #else - fd = open_readonly(real_path, O_RDONLY); + fd = open_readonly(real_path, O_RDONLY|O_CLOEXEC); file->path = real_path; #endif file->freepath = real_path; /* free this when done */ @@ -336,7 +336,7 @@ static CURLcode file_upload(struct conne return CURLE_FILE_COULDNT_READ_FILE; /* fix: better error code */ if(data->state.resume_from) - fp = fopen( file->path, "ab" ); + fp = fopen( file->path, "abe" ); else { int fd; @@ -344,7 +344,7 @@ static CURLcode file_upload(struct conne fd = open(file->path, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, conn->data->set.new_file_perms); #else - fd = open(file->path, O_WRONLY|O_CREAT|O_TRUNC, + fd = open(file->path, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, conn->data->set.new_file_perms); #endif if(fd < 0) { @@ -352,7 +352,7 @@ static CURLcode file_upload(struct conne return CURLE_WRITE_ERROR; } close(fd); - fp = fopen(file->path, "wb"); + fp = fopen(file->path, "wbe"); } if(!fp) { --- lib/formdata.c.orig +++ lib/formdata.c @@ -1207,7 +1207,7 @@ CURLcode Curl_getformdata(struct Session FILE *fileread; fileread = strequal("-", file->contents)? - stdin:fopen(file->contents, "rb"); /* binary read for win32 */ + stdin:fopen(file->contents, "rbe"); /* binary read for win32 */ /* * VMS: This only allows for stream files on VMS. Stream files are @@ -1338,7 +1338,7 @@ static size_t readfromfile(struct Form * else { if(!form->fp) { /* this file hasn't yet been opened */ - form->fp = fopen(form->data->line, "rb"); /* b is for binary */ + form->fp = fopen(form->data->line, "rbe"); /* b is for binary */ if(!form->fp) return (size_t)-1; /* failure */ } --- lib/hostip6.c.orig +++ lib/hostip6.c @@ -45,7 +45,7 @@ #ifdef HAVE_PROCESS_H #include <process.h> #endif - +#include <fcntl.h> #include "urldata.h" #include "sendf.h" #include "hostip.h" @@ -113,7 +113,7 @@ bool Curl_ipv6works(void) static int ipv6_works = -1; if(-1 == ipv6_works) { /* probe to see if we have a working IPv6 stack */ - curl_socket_t s = socket(PF_INET6, SOCK_DGRAM, 0); + curl_socket_t s = socket(PF_INET6, SOCK_DGRAM | O_CLOEXEC, 0); if(s == CURL_SOCKET_BAD) /* an ipv6 address was requested but we can't get/use one */ ipv6_works = 0; --- lib/if2ip.c.orig +++ lib/if2ip.c @@ -153,7 +153,7 @@ char *Curl_if2ip(int af, const char *int if(len >= sizeof(req.ifr_name)) return NULL; - dummy = socket(AF_INET, SOCK_STREAM, 0); + dummy = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0); if(CURL_SOCKET_BAD == dummy) return NULL; --- lib/netrc.c.orig +++ lib/netrc.c @@ -110,7 +110,7 @@ int Curl_parsenetrc(const char *host, netrc_alloc = TRUE; } - file = fopen(netrcfile, "r"); + file = fopen(netrcfile, "re"); if(file) { char *tok; char *tok_buf; --- lib/ssluse.c.orig +++ lib/ssluse.c @@ -436,7 +436,7 @@ int cert_stuff(struct connectdata *conn, STACK_OF(X509) *ca = NULL; int i; - f = fopen(cert_file,"rb"); + f = fopen(cert_file,"rbe"); if(!f) { failf(data, "could not open PKCS12 file '%s'", cert_file); return 0; @@ -2316,7 +2316,7 @@ static CURLcode servercert(struct connec /* e.g. match issuer name with provided issuer certificate */ if(data->set.str[STRING_SSL_ISSUERCERT]) { - fp=fopen(data->set.str[STRING_SSL_ISSUERCERT],"r"); + fp=fopen(data->set.str[STRING_SSL_ISSUERCERT],"re"); if(!fp) { if(strict) failf(data, "SSL: Unable to open issuer cert (%s)\n",
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor