diff --git a/src/log.c b/src/log.c index e0679e15..34e34532 100644 --- a/src/log.c +++ b/src/log.c @@ -129,10 +129,11 @@ void open_logbuffer(void) { return; } - if (ftruncate(logbuffer_shm, logbuffer_size) == -1) { + int ret; + if ((ret = posix_fallocate(logbuffer_shm, 0, logbuffer_size)) != 0) { close(logbuffer_shm); shm_unlink(shmlogname); - fprintf(stderr, "Could not ftruncate SHM segment for the i3 log: %s\n", strerror(errno)); + fprintf(stderr, "Could not ftruncate SHM segment for the i3 log: %s\n", strerror(ret)); return; }