mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-06 21:51:30 +00:00
OpenBSD fixes by Piotr Sikora
This commit is contained in:
@@ -30,7 +30,7 @@ int uwsgi_load_plugin(struct uwsgi_server *uwsgi, int modifier, char *plugin, ch
|
||||
|
||||
if (absolute) {
|
||||
plugin_name = malloc(strlen(plugin) + 1);
|
||||
strcpy(plugin_name, plugin);
|
||||
strlcpy(plugin_name, plugin, strlen(plugin));
|
||||
}
|
||||
else {
|
||||
plugin_name = malloc(strlen(UWSGI_PLUGIN_DIR) + 1 + strlen(plugin) + 1);
|
||||
@@ -38,9 +38,9 @@ int uwsgi_load_plugin(struct uwsgi_server *uwsgi, int modifier, char *plugin, ch
|
||||
uwsgi_error("malloc()");
|
||||
return -1 ;
|
||||
}
|
||||
strcpy(plugin_name, UWSGI_PLUGIN_DIR);
|
||||
strcat(plugin_name, "/");
|
||||
strcat(plugin_name, plugin);
|
||||
strlcpy(plugin_name, UWSGI_PLUGIN_DIR, strlen(UWSGI_PLUGIN_DIR));
|
||||
strlcat(plugin_name, "/", 1);
|
||||
strlcat(plugin_name, plugin, strlen(plugin));
|
||||
}
|
||||
plugin_handle = dlopen(plugin_name, RTLD_NOW | RTLD_GLOBAL);
|
||||
free(plugin_name);
|
||||
|
||||
+6
-2
@@ -59,10 +59,11 @@ ssize_t uwsgi_sendfile(struct uwsgi_server *uwsgi, struct wsgi_request *wsgi_req
|
||||
|
||||
ssize_t uwsgi_do_sendfile(int sockfd, int filefd, size_t filesize, size_t chunk, off_t *pos, int async) {
|
||||
|
||||
int sf_ret;
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
|
||||
int sf_ret;
|
||||
|
||||
off_t sf_len = filesize ;
|
||||
|
||||
if (async > 1) {
|
||||
@@ -81,6 +82,7 @@ ssize_t uwsgi_do_sendfile(int sockfd, int filefd, size_t filesize, size_t chunk,
|
||||
|
||||
return sf_len;
|
||||
#elif defined(__APPLE__)
|
||||
int sf_ret;
|
||||
off_t sf_len = filesize ;
|
||||
|
||||
if (async > 1) {
|
||||
@@ -100,6 +102,8 @@ ssize_t uwsgi_do_sendfile(int sockfd, int filefd, size_t filesize, size_t chunk,
|
||||
return sf_len;
|
||||
|
||||
#elif defined(__linux__) || defined(__sun__)
|
||||
int sf_ret;
|
||||
|
||||
if (async > 1) {
|
||||
sf_ret = sendfile(sockfd, filefd, pos, chunk);
|
||||
}
|
||||
@@ -114,7 +118,7 @@ ssize_t uwsgi_do_sendfile(int sockfd, int filefd, size_t filesize, size_t chunk,
|
||||
|
||||
return sf_ret ;
|
||||
#else
|
||||
static nosf_buf_size = 0 ;
|
||||
static size_t nosf_buf_size = 0 ;
|
||||
static char *nosf_buf ;
|
||||
|
||||
ssize_t jlen = 0;
|
||||
|
||||
Reference in New Issue
Block a user