FreeBSD fix and applied riccardo's patch

This commit is contained in:
roberto@freebsd64
2011-06-26 11:35:18 +02:00
parent 8b423d00e9
commit d673627c79
3 changed files with 15 additions and 6 deletions
+8
View File
@@ -4,7 +4,9 @@
extern struct uwsgi_server uwsgi;
static void spooler_readdir(char *);
#ifdef __linux__
static void spooler_scandir(char *);
#endif
void spooler_manage_task(char *, char *);
pid_t spooler_start() {
@@ -163,7 +165,9 @@ void spooler() {
}
if (uwsgi.spooler_ordered) {
#ifdef __linux__
spooler_scandir(uwsgi.spool_dir);
#endif
}
else {
spooler_readdir(uwsgi.spool_dir);
@@ -174,6 +178,7 @@ void spooler() {
}
}
#ifdef __linux__
static void spooler_scandir(char *dir) {
struct dirent **tasklist;
@@ -192,6 +197,7 @@ static void spooler_scandir(char *dir) {
free(tasklist);
}
#endif
static void spooler_readdir(char *dir) {
@@ -226,6 +232,7 @@ void spooler_manage_task(char *dir, char *task) {
return;
}
#ifdef __linux__
if (S_ISDIR(sf_lstat.st_mode) && uwsgi.spooler_ordered) {
if (chdir(task)) {
uwsgi_error("chdir()");
@@ -237,6 +244,7 @@ void spooler_manage_task(char *dir, char *task) {
chdir(dir);
return;
}
#endif
if (!S_ISREG(sf_lstat.st_mode)) {
return;
}
+5 -5
View File
@@ -2401,16 +2401,16 @@ int *uwsgi_attach_fd(int fd, int count, char *code, size_t code_len) {
return NULL;
}
if ((size_t) (cmsg->cmsg_len - ((char *)CMSG_DATA(cmsg)- (char *)cmsg)) > (size_t) (sizeof(int) * (count + 1))) {
uwsgi_log("not enough space for sockets data, consider increasing it\n");
return NULL;
}
ret = uwsgi_malloc(sizeof(int) * (count + 1));
for(i=0;i<count+1;i++) {
ret[i] = -1;
}
if ((size_t) (cmsg->cmsg_len - ((char *)CMSG_DATA(cmsg)- (char *)cmsg)) > (size_t) (sizeof(int) * (count + 1))) {
uwsgi_log("not enough space for sockets data, consider increasing it\n");
return NULL;
}
memcpy(ret, CMSG_DATA(cmsg), cmsg->cmsg_len - ((char *)CMSG_DATA(cmsg)- (char *)cmsg));
free(msg_control);
+2 -1
View File
@@ -116,7 +116,6 @@
#define __USE_GNU
#endif
#include <dirent.h>
#include <sched.h>
#include <sys/prctl.h>
#include <linux/limits.h>
@@ -131,6 +130,8 @@ extern int pivot_root(const char * new_root, const char * put_old);
#include <limits.h>
#endif
#include <dirent.h>
#ifdef UWSGI_SCTP
#include <netinet/sctp.h>
#endif