fix the build on OS X

OS X doesn't have posix_fallocate() yet, so put
bf760d0241 in
    #if defined(__APPLE__)

the cd fails with:
    /bin/sh: line 0: cd: include: No such file or directory
so give it a path relative to the top directory
This commit is contained in:
Jean-Philippe Ouellet
2013-11-26 05:41:56 -05:00
committed by Michael Stapelberg
parent 18cfc36408
commit 755188220f
2 changed files with 8 additions and 3 deletions

View File

@ -129,11 +129,16 @@ void open_logbuffer(void) {
return;
}
#if defined(__APPLE__)
if (ftruncate(logbuffer_shm, logbuffer_size) == -1) {
fprintf(stderr, "Could not ftruncate SHM segment for the i3 log: %s\n", strerror(errno));
#else
int ret;
if ((ret = posix_fallocate(logbuffer_shm, 0, logbuffer_size)) != 0) {
fprintf(stderr, "Could not ftruncate SHM segment for the i3 log: %s\n", strerror(ret));
#endif
close(logbuffer_shm);
shm_unlink(shmlogname);
fprintf(stderr, "Could not ftruncate SHM segment for the i3 log: %s\n", strerror(ret));
return;
}