diff options
Diffstat (limited to '')
-rw-r--r-- | src/libmdsserver/macros.h | 8 | ||||
-rw-r--r-- | src/mds-base.c | 4 | ||||
-rw-r--r-- | src/mds.c | 30 |
3 files changed, 17 insertions, 25 deletions
diff --git a/src/libmdsserver/macros.h b/src/libmdsserver/macros.h index f82c01d..5329298 100644 --- a/src/libmdsserver/macros.h +++ b/src/libmdsserver/macros.h @@ -384,14 +384,14 @@ * @param ... The condition */ #define fail_if(...) \ - if (__VA_ARGS__) \ - do \ + do \ + if (__VA_ARGS__) \ { \ if ((errno != EMSGSIZE) && (errno != ECONNRESET) && (errno != EINTR)) \ fprintf(stderr, "failure at %s:%i\n", __FILE__, __LINE__); \ - goto fail; \ + goto fail; \ } \ - while (0) + while (0) /** diff --git a/src/mds-base.c b/src/mds-base.c index e80b902..85f0ef7 100644 --- a/src/mds-base.c +++ b/src/mds-base.c @@ -630,9 +630,9 @@ int trap_signals(void) /* Implement death on SIGDANGER or ignoral of SIGDANGER. */ if (server_characteristics.danger_is_deadly && !is_immortal) - { fail_if (xsigaction(SIGDANGER, commit_suicide) < 0); } + fail_if (xsigaction(SIGDANGER, commit_suicide) < 0); else - { fail_if (xsigaction(SIGDANGER, received_danger) < 0); } + fail_if (xsigaction(SIGDANGER, received_danger) < 0); return 0; fail: @@ -445,15 +445,11 @@ int create_directory_root(const char* pathname) else /* Directory is missing, create it. */ if (mkdir(pathname, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) < 0) - { - /* Unlikely race condition. */ - fail_if (errno != EEXIST); - } + /* Unlikely race condition. */ + fail_if (errno != EEXIST); else - { - /* Set ownership. */ - fail_if (chown(pathname, ROOT_USER_UID, ROOT_GROUP_GID) < 0); - } + /* Set ownership. */ + fail_if (chown(pathname, ROOT_USER_UID, ROOT_GROUP_GID) < 0); return 0; fail: @@ -483,17 +479,13 @@ int create_directory_user(const char* pathname) } } else - { - /* Directory is missing, create it. */ - if (mkdir(pathname, S_IRWXU) < 0) - { - /* Unlikely race condition. */ - fail_if (errno != EEXIST); - } - else - /* Set ownership. */ - fail_if (chown(pathname, getuid(), NOBODY_GROUP_GID) < 0); - } + /* Directory is missing, create it. */ + if (mkdir(pathname, S_IRWXU) < 0) + /* Unlikely race condition. */ + fail_if (errno != EEXIST); + else + /* Set ownership. */ + fail_if (chown(pathname, getuid(), NOBODY_GROUP_GID) < 0); return 0; fail: |