diff options
author | dimitri staessens <[email protected]> | 2016-06-20 21:58:17 +0200 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2016-06-20 21:58:17 +0200 |
commit | 34f96731f5fb8ab8a1f7018366fc28fd041d73e2 (patch) | |
tree | aff0b0ed3474c7cdb5f6ba7e62ca5e33ccedb814 /src/lib | |
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')
-rw-r--r-- | src/lib/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/lib/ipcp.c | 8 | ||||
-rw-r--r-- | src/lib/shm_ap_rbuff.c | 11 | ||||
-rw-r--r-- | src/lib/shm_du_map.c | 8 | ||||
-rw-r--r-- | src/lib/sockets.c | 6 |
5 files changed, 27 insertions, 8 deletions
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 796a0b7c..7db083b6 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -51,7 +51,7 @@ if (CMAKE_BUILD_TYPE MATCHES Debug) MACRO_ADD_COMPILE_FLAGS(ouroboros -DCONFIG_OUROBOROS_DEBUG) endif (CMAKE_BUILD_TYPE MATCHES Debug) -install(TARGETS ouroboros LIBRARY DESTINATION lib) +install(TARGETS ouroboros LIBRARY DESTINATION usr/lib) target_include_directories(ouroboros PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/src/lib/ipcp.c b/src/lib/ipcp.c index 89756235..a43afd21 100644 --- a/src/lib/ipcp.c +++ b/src/lib/ipcp.c @@ -105,11 +105,11 @@ pid_t ipcp_create(char * ipcp_name, pid_t pid = 0; char irmd_pid[10]; size_t len = 0; - char * ipcp_dir = "bin"; + char * ipcp_dir = "sbin/"; char * full_name = NULL; char * exec_name = NULL; - sprintf (irmd_pid, "%u", getpid()); + sprintf(irmd_pid, "%u", getpid()); pid = fork(); if (pid == -1) { @@ -135,7 +135,7 @@ pid_t ipcp_create(char * ipcp_name, len += strlen(INSTALL_DIR); len += strlen(ipcp_dir); len += strlen(exec_name); - len += 3; + len += 1; full_name = malloc(len + 1); if (full_name == NULL) { @@ -144,9 +144,7 @@ pid_t ipcp_create(char * ipcp_name, } strcpy(full_name, INSTALL_DIR); - strcat(full_name, "/"); strcat(full_name, ipcp_dir); - strcat(full_name, "/"); strcat(full_name, exec_name); full_name[len] = '\0'; 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); diff --git a/src/lib/shm_du_map.c b/src/lib/shm_du_map.c index 0ce6bdcd..5f935d3f 100644 --- a/src/lib/shm_du_map.c +++ b/src/lib/shm_du_map.c @@ -21,12 +21,14 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <ouroboros/config.h> #include <ouroboros/shm_du_map.h> #include <pthread.h> #include <sys/mman.h> #include <fcntl.h> #include <stdlib.h> #include <string.h> +#include <sys/stat.h> #define OUROBOROS_PREFIX "shm_du_map" @@ -95,6 +97,12 @@ struct shm_du_map * shm_du_map_create() return NULL; } + if (fchmod(shm_fd, 0666)) { + LOG_DBGF("Failed to chmod shared memory map."); + free(dum); + return NULL; + } + if (lseek(shm_fd, SHM_FILE_SIZE - 1, SEEK_SET) < 0) { LOG_DBGF("Failed to extend shared memory map."); free(dum); diff --git a/src/lib/sockets.c b/src/lib/sockets.c index 6c51e916..403d2833 100644 --- a/src/lib/sockets.c +++ b/src/lib/sockets.c @@ -22,6 +22,7 @@ #define OUROBOROS_PREFIX "libouroboros-sockets" +#include <ouroboros/config.h> #include <ouroboros/logs.h> #include <ouroboros/common.h> #include <ouroboros/sockets.h> @@ -153,7 +154,7 @@ char * ipcp_sock_path(pid_t pid) char * full_name = NULL; char * pid_string = NULL; size_t len = 0; - char * delim = "-"; + char * delim = "_"; len = n_digits(pid); pid_string = malloc(len + 1); @@ -164,6 +165,8 @@ char * ipcp_sock_path(pid_t pid) len += strlen(IPCP_SOCK_PATH_PREFIX); len += strlen(delim); + len += strlen(SOCK_PATH_SUFFIX); + full_name = malloc(len + 1); if (full_name == NULL) { free(pid_string); @@ -173,6 +176,7 @@ char * ipcp_sock_path(pid_t pid) strcpy(full_name, IPCP_SOCK_PATH_PREFIX); strcat(full_name, delim); strcat(full_name, pid_string); + strcat(full_name, SOCK_PATH_SUFFIX); free(pid_string); |