diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-06-20 21:58:17 +0200 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-06-20 21:58:17 +0200 |
commit | 34f96731f5fb8ab8a1f7018366fc28fd041d73e2 (patch) | |
tree | aff0b0ed3474c7cdb5f6ba7e62ca5e33ccedb814 /src/lib/shm_ap_rbuff.c | |
parent | 6270143e57306d11be5c02ee3c7857808583c0f5 (diff) | |
parent | 550cfa775b048abe183c4fdcc8ada8476e562185 (diff) | |
download | ouroboros-34f96731f5fb8ab8a1f7018366fc28fd041d73e2.tar.gz ouroboros-34f96731f5fb8ab8a1f7018366fc28fd041d73e2.zip |
Merged in sandervrijders/ouroboros/be (pull request #134)
build: Change install directories and set correct permissions
Diffstat (limited to 'src/lib/shm_ap_rbuff.c')
-rw-r--r-- | src/lib/shm_ap_rbuff.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/shm_ap_rbuff.c b/src/lib/shm_ap_rbuff.c index a855ed8f..6ee2936c 100644 --- a/src/lib/shm_ap_rbuff.c +++ b/src/lib/shm_ap_rbuff.c @@ -20,10 +20,12 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <ouroboros/shm_ap_rbuff.h> +#include <ouroboros/config.h> + #define OUROBOROS_PREFIX "shm_ap_rbuff" #include <ouroboros/logs.h> +#include <ouroboros/shm_ap_rbuff.h> #include <pthread.h> #include <sys/mman.h> @@ -34,6 +36,7 @@ #include <unistd.h> #include <stdbool.h> #include <errno.h> +#include <sys/stat.h> #define SHM_RBUFF_FILE_SIZE (SHM_RBUFF_SIZE * sizeof(struct rb_entry) \ + 2 * sizeof(size_t) + sizeof(pthread_mutex_t) \ @@ -80,6 +83,12 @@ struct shm_ap_rbuff * shm_ap_rbuff_create() return NULL; } + if (fchmod(shm_fd, 0666)) { + LOG_DBGF("Failed to chmod shared memory."); + free(rb); + return NULL; + } + if (lseek(shm_fd, SHM_RBUFF_FILE_SIZE - 1, SEEK_SET) < 0) { LOG_DBGF("Failed to extend ringbuffer."); free(rb); |