From: Marcel Holtmann Date: Mon, 13 Apr 2009 21:11:58 +0000 (+0200) Subject: Add error reporting for state and storage directory creation X-Git-Tag: 0.16~65 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2cf1a67e444cb3aadefd2b1df970a5269c49e3ce;p=platform%2Fupstream%2Fconnman.git Add error reporting for state and storage directory creation --- diff --git a/src/main.c b/src/main.c index 457776c..56537e1 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);