mirror of
https://github.com/debauchee/barrier.git
synced 2026-12-01 00:05:10 +08:00
Fixed Issue #20: Compiling with gcc > 4.3 failes
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <cstdlib>
|
||||
|
||||
//
|
||||
// CArchDaemonUnix
|
||||
@@ -37,6 +38,8 @@ CArchDaemonUnix::~CArchDaemonUnix()
|
||||
int
|
||||
CArchDaemonUnix::daemonize(const char* name, DaemonFunc func)
|
||||
{
|
||||
int dummy;
|
||||
|
||||
// fork so shell thinks we're done and so we're not a process
|
||||
// group leader
|
||||
switch (fork()) {
|
||||
@@ -57,7 +60,7 @@ CArchDaemonUnix::daemonize(const char* name, DaemonFunc func)
|
||||
setsid();
|
||||
|
||||
// chdir to root so we don't keep mounted filesystems points busy
|
||||
chdir("/");
|
||||
dummy = chdir("/");
|
||||
|
||||
// mask off permissions for any but owner
|
||||
umask(077);
|
||||
@@ -71,7 +74,7 @@ CArchDaemonUnix::daemonize(const char* name, DaemonFunc func)
|
||||
// of standard I/O safely goes in the bit bucket.
|
||||
open("/dev/null", O_RDONLY);
|
||||
open("/dev/null", O_RDWR);
|
||||
dup(1);
|
||||
dummy = dup(1);
|
||||
|
||||
// invoke function
|
||||
return func(1, &name);
|
||||
|
||||
@@ -316,8 +316,10 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout)
|
||||
if (n > 0 && unblockPipe != NULL && (pfd[num].revents & POLLIN) != 0) {
|
||||
// the unblock event was signalled. flush the pipe.
|
||||
char dummy[100];
|
||||
int ignore;
|
||||
|
||||
do {
|
||||
read(unblockPipe[0], dummy, sizeof(dummy));
|
||||
ignore = read(unblockPipe[0], dummy, sizeof(dummy));
|
||||
} while (errno != EAGAIN);
|
||||
|
||||
// don't count this unblock pipe in return value
|
||||
@@ -489,7 +491,9 @@ CArchNetworkBSD::unblockPollSocket(CArchThread thread)
|
||||
const int* unblockPipe = getUnblockPipeForThread(thread);
|
||||
if (unblockPipe != NULL) {
|
||||
char dummy = 0;
|
||||
write(unblockPipe[1], &dummy, 1);
|
||||
int ignore;
|
||||
|
||||
ignore = write(unblockPipe[1], &dummy, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "CArch.h"
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <climits>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#if HAVE_LOCALE_H
|
||||
# include <locale.h>
|
||||
#endif
|
||||
@@ -26,7 +27,7 @@
|
||||
# include <wchar.h>
|
||||
#elif __APPLE__
|
||||
// wtf? Darwin puts mbtowc() et al. in stdlib
|
||||
# include <stdlib.h>
|
||||
# include <cstdlib>
|
||||
#else
|
||||
// platform apparently has no wchar_t support. provide dummy
|
||||
// implementations. hopefully at least the C++ compiler has
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include "XArchUnix.h"
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
|
||||
//
|
||||
// XArchEvalUnix
|
||||
|
||||
Reference in New Issue
Block a user