diff options
author | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-02-15 15:20:22 +0530 |
---|---|---|
committer | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-02-15 15:20:22 +0530 |
commit | 86ae67f117bc2a8c385144065c01e63027248a50 (patch) | |
tree | 9caa52468a2ad6ea1a79e1626c4bb439200e1f52 /daemon/gluster-blockd.c | |
parent | 8eaecd2b99e686dbf6acd401b55f04220f3149d0 (diff) |
gluster-blockd: create logging directories
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Diffstat (limited to 'daemon/gluster-blockd.c')
-rw-r--r-- | daemon/gluster-blockd.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/daemon/gluster-blockd.c b/daemon/gluster-blockd.c index 01efbbb..24fde90 100644 --- a/daemon/gluster-blockd.c +++ b/daemon/gluster-blockd.c @@ -9,6 +9,7 @@ */ +# include <sys/stat.h> # include <pthread.h> # include <rpc/pmap_clnt.h> @@ -17,6 +18,24 @@ +static bool +glusterBlockLogdirCreate(void) +{ + struct stat st = {0}; + + if (stat(GB_LOGDIR, &st) == -1) { + if (mkdir(GB_LOGDIR, 0755) == -1) { + LOG("mgmt", GB_LOG_ERROR, "mkdir(%s) failed (%s)", + GB_LOGDIR, strerror (errno)); + + return FALSE; + } + } + + return TRUE; +} + + void * glusterBlockCliThreadProc (void *vargp) { @@ -135,6 +154,9 @@ main (int argc, char **argv) pthread_t cli_thread; pthread_t server_thread; + if (glusterBlockLogdirCreate()) { + return -1; + } pmap_unset(GLUSTER_BLOCK_CLI, GLUSTER_BLOCK_CLI_VERS); pmap_unset(GLUSTER_BLOCK, GLUSTER_BLOCK_VERS); |