From 2cf1a67e444cb3aadefd2b1df970a5269c49e3ce Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 13 Apr 2009 23:11:58 +0200 Subject: Add error reporting for state and storage directory creation --- src/main.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') 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); -- cgit v1.2.3