diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-09-20 17:08:54 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-09-20 17:08:54 +0200 |
commit | d24a954dde20a303b01f09f96c957a6fc062f077 (patch) | |
tree | ea79adab8056cf548ea1d218b9f5dd2b9d62a810 | |
parent | SIGRTMAX is used internally by valgrind (diff) | |
download | mds-d24a954dde20a303b01f09f96c957a6fc062f077.tar.gz mds-d24a954dde20a303b01f09f96c957a6fc062f077.tar.bz2 mds-d24a954dde20a303b01f09f96c957a6fc062f077.tar.xz |
kernel: remove umask until we exec into mds-server
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | src/mds.c | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -53,6 +53,11 @@ static char** argv; */ static const char* master_server = LIBEXECDIR "/mds-server"; +/** + * The umask the server start with + */ +static mode_t saved_umask; + /** * Entry point of the program @@ -107,6 +112,9 @@ int main(int argc_, char** argv_) if (xsigaction(SIGDANGER, SIG_IGN) < 0) xperror(*argv); + /* Remove umask. */ + saved_umask = umask(0); + /* Create directory for socket files, PID files and such. */ if (create_directory_root(MDS_RUNTIME_ROOT_DIRECTORY)) return 1; @@ -333,7 +341,11 @@ int spawn_and_respawn_server(int fd) if (pid == 0) /* Child. */ { + /* If this image exits, it should do so with failure status. */ rc++; + /* Reinstate original umask. */ + umask(saved_umask); + /* Change image into the master server. */ exec_master_server(child_args); goto pfail; } @@ -435,9 +447,11 @@ int create_directory_root(const char* pathname) goto pfail; } else - /* Set ownership. */ - if (chown(pathname, ROOT_USER_UID, ROOT_GROUP_GID) < 0) - goto pfail; + { + /* Set ownership. */ + if (chown(pathname, ROOT_USER_UID, ROOT_GROUP_GID) < 0) + goto pfail; + } return 0; |