diff options
author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-05-15 16:14:13 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-05-15 16:14:13 +0200 |
commit | 061758159ebfd38fe03682bd3aa44cf9f8ac915f (patch) | |
tree | 0a26ce8198ab305846da06570d336355791e2c30 /src/lib/shm_ap_rbuff.c | |
parent | 37a0ce98538c69b264898b7994fbac1d6e465a2f (diff) | |
parent | 5fe9706b823cd441703239ece020e517d722d88c (diff) | |
download | ouroboros-061758159ebfd38fe03682bd3aa44cf9f8ac915f.tar.gz ouroboros-061758159ebfd38fe03682bd3aa44cf9f8ac915f.zip |
Merged in dstaesse/ouroboros/release-fd (pull request #89)
lib: cleanup file descriptors for shared memory
Diffstat (limited to 'src/lib/shm_ap_rbuff.c')
-rw-r--r-- | src/lib/shm_ap_rbuff.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/shm_ap_rbuff.c b/src/lib/shm_ap_rbuff.c index 0524a96c..71a7e733 100644 --- a/src/lib/shm_ap_rbuff.c +++ b/src/lib/shm_ap_rbuff.c @@ -180,6 +180,9 @@ void shm_ap_rbuff_close(struct shm_ap_rbuff * rb) return; } + if (close(rb->fd) < 0) + LOG_DBGF("Couldn't close shared memory."); + if (munmap(rb->shm_base, SHM_RBUFF_FILE_SIZE) == -1) LOG_DBGF("Couldn't unmap shared memory."); @@ -200,6 +203,9 @@ void shm_ap_rbuff_destroy(struct shm_ap_rbuff * rb) return; } + if (close(rb->fd) < 0) + LOG_DBGF("Couldn't close shared memory."); + sprintf(fn, SHM_AP_RBUFF_PREFIX "%d", rb->pid); if (munmap(rb->shm_base, SHM_RBUFF_FILE_SIZE) == -1) |