diff options
author | Alexander Wenzel <Alexander.AW.Wenzel@bmw.de> | 2014-03-26 09:53:03 +0100 |
---|---|---|
committer | Alexander Wenzel <Alexander.AW.Wenzel@bmw.de> | 2014-04-01 10:20:31 +0200 |
commit | 8594f384fe8d622c20e7cb6091a2e99313e9830e (patch) | |
tree | 7a64886ffd43a1cf54f7cbd400ee5acbbc5691bd | |
parent | eec28320c7f903976ede0f69226948cc1d46334a (diff) | |
download | dlt-daemon-8594f384fe8d622c20e7cb6091a2e99313e9830e.tar.gz dlt-daemon-8594f384fe8d622c20e7cb6091a2e99313e9830e.tar.bz2 dlt-daemon-8594f384fe8d622c20e7cb6091a2e99313e9830e.zip |
Fixed: Creation of dltpipes directory is too late.
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
-rw-r--r-- | src/daemon/dlt-daemon.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c index 3c4f751..8f4d9de 100644 --- a/src/daemon/dlt-daemon.c +++ b/src/daemon/dlt-daemon.c @@ -625,7 +625,23 @@ int dlt_daemon_local_init_p1(DltDaemon *daemon, DltDaemonLocal *daemon_local, in } #endif + /* create dlt pipes directory */ + ret=mkdir(DLT_USER_DIR, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH | S_ISVTX ); + if (ret==-1 && errno != EEXIST) + { + sprintf(str,"FIFO user dir %s cannot be created!\n", DLT_USER_DIR); + dlt_log(LOG_ERR, str); + return -1; + } + // S_ISGID cannot be set by mkdir, let's reassign right bits + ret=chmod(DLT_USER_DIR, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH | S_ISGID | S_ISVTX ); + if (ret==-1) + { + sprintf(str,"FIFO user dir %s cannot be chmoded!\n", DLT_USER_DIR); + dlt_log(LOG_ERR, str); + return -1; + } /* Check for daemon mode */ if (daemon_local->flags.dflag) @@ -765,23 +781,6 @@ int dlt_daemon_local_connection_init(DltDaemon *daemon, DltDaemonLocal *daemon_l /* open named pipe(FIFO) to receive DLT messages from users */ umask(0); - ret=mkdir(DLT_USER_DIR, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH | S_ISVTX ); - if (ret==-1 && errno != EEXIST) - { - sprintf(str,"FIFO user dir %s cannot be created!\n", DLT_USER_DIR); - dlt_log(LOG_ERR, str); - return -1; - } - - // S_ISGID cannot be set by mkdir, let's reassign right bits - ret=chmod(DLT_USER_DIR, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH | S_ISGID | S_ISVTX ); - if (ret==-1) - { - sprintf(str,"FIFO user dir %s cannot be chmoded!\n", DLT_USER_DIR); - dlt_log(LOG_ERR, str); - return -1; - } - /* Try to delete existing pipe, ignore result of unlink */ unlink(DLT_USER_FIFO); |