summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-04-13 23:11:58 +0200
committerMarcel Holtmann <marcel@holtmann.org>2009-04-13 23:11:58 +0200
commit2cf1a67e444cb3aadefd2b1df970a5269c49e3ce (patch)
treea1a1124dba933e68f5e5b5d1f1640bd6c1433b1c /src
parentd3e4c9c49a4baaf568ff8955ce42bafbcede8f8f (diff)
downloadconnman-2cf1a67e444cb3aadefd2b1df970a5269c49e3ce.tar.gz
connman-2cf1a67e444cb3aadefd2b1df970a5269c49e3ce.tar.bz2
connman-2cf1a67e444cb3aadefd2b1df970a5269c49e3ce.zip
Add error reporting for state and storage directory creation
Diffstat (limited to 'src')
-rw-r--r--src/main.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 457776c2..56537e12 100644
--- a/src/main.c
+++ b/src/main.c
@@ -127,11 +127,17 @@ int main(int argc, char *argv[])
}
}
- mkdir(STATEDIR, S_IRUSR | S_IWUSR | S_IXUSR |
- S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+ if (mkdir(STATEDIR, S_IRUSR | S_IWUSR | S_IXUSR |
+ S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) < 0) {
+ if (errno != EEXIST)
+ perror("Failed to create state directory");
+ }
- mkdir(STORAGEDIR, S_IRUSR | S_IWUSR | S_IXUSR |
- S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+ if (mkdir(STORAGEDIR, S_IRUSR | S_IWUSR | S_IXUSR |
+ S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) < 0) {
+ if (errno != EEXIST)
+ perror("Failed to create storage directory");
+ }
main_loop = g_main_loop_new(NULL, FALSE);