diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/lockfile.c | 4 | ||||
-rw-r--r-- | src/lib/shm_ap_rbuff.c | 2 | ||||
-rw-r--r-- | src/lib/shm_du_map.c | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/lockfile.c b/src/lib/lockfile.c index a93d5f17..75ee2085 100644 --- a/src/lib/lockfile.c +++ b/src/lib/lockfile.c @@ -60,7 +60,7 @@ struct lockfile * lockfile_create() { return NULL; } - if (lseek(lf->fd, LF_SIZE - 1, SEEK_SET) < 0) { + if (ftruncate(lf->fd, LF_SIZE - 1) < 0) { LOG_DBGF("Failed to extend lockfile."); free(lf); return NULL; @@ -99,7 +99,7 @@ struct lockfile * lockfile_open() { return NULL; lf->fd = shm_open(LOCKFILE_NAME, O_RDWR, 0666); - if (lf->fd == -1) { + if (lf->fd < 0) { LOG_DBGF("Could not open lock file."); free(lf); return NULL; diff --git a/src/lib/shm_ap_rbuff.c b/src/lib/shm_ap_rbuff.c index 618c4c19..605e5678 100644 --- a/src/lib/shm_ap_rbuff.c +++ b/src/lib/shm_ap_rbuff.c @@ -90,7 +90,7 @@ struct shm_ap_rbuff * shm_ap_rbuff_create() return NULL; } - if (lseek(shm_fd, SHM_RBUFF_FILE_SIZE - 1, SEEK_SET) < 0) { + if (ftruncate(shm_fd, SHM_RBUFF_FILE_SIZE - 1) < 0) { LOG_DBGF("Failed to extend ringbuffer."); free(rb); return NULL; diff --git a/src/lib/shm_du_map.c b/src/lib/shm_du_map.c index 9d2d4f6e..6dc4a1bd 100644 --- a/src/lib/shm_du_map.c +++ b/src/lib/shm_du_map.c @@ -161,7 +161,7 @@ struct shm_du_map * shm_du_map_create() return NULL; } - if (lseek(shm_fd, SHM_FILE_SIZE - 1, SEEK_SET) < 0) { + if (ftruncate(shm_fd, SHM_FILE_SIZE - 1) < 0) { LOG_DBGF("Failed to extend shared memory map."); free(dum); return NULL; @@ -235,7 +235,7 @@ struct shm_du_map * shm_du_map_open() } shm_fd = shm_open(SHM_DU_MAP_FILENAME, O_RDWR, 0666); - if (shm_fd == -1) { + if (shm_fd < 0) { LOG_DBGF("Failed opening shared memory."); return NULL; } |