aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-12-09 04:03:11 +0100
committerMattias Andrée <maandree@operamail.com>2014-12-09 04:03:15 +0100
commit7bd34436ab676eee1ace2684eb785e536846e199 (patch)
tree20825c7d95117ad894f621e3450f94de4e23bb2d /src/mds.c
parentdo no print whence an error occurred if it is EMSGSIZE, ECONNRESET or EINTR, those are not real errors, just abnormalities (diff)
downloadmds-7bd34436ab676eee1ace2684eb785e536846e199.tar.gz
mds-7bd34436ab676eee1ace2684eb785e536846e199.tar.bz2
mds-7bd34436ab676eee1ace2684eb785e536846e199.tar.xz
make fail_if friendlier to complex if-statements
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/mds.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/mds.c b/src/mds.c
index 8dce0d1..29b1d94 100644
--- a/src/mds.c
+++ b/src/mds.c
@@ -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: