diff options
-rw-r--r-- | src/lpass.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lpass.c b/src/lpass.c index 2fcc1ad..70b4b80 100644 --- a/src/lpass.c +++ b/src/lpass.c @@ -69,12 +69,11 @@ static int goto_maindir() if(errno == ENOENT) { // create main directory: result = mkdir(rootdir, S_IRWXU); - if(result) { - if(errno != EEXIST) - print_error("Error: %s\n", strerror(errno)); - } - else // try again: + if(result && errno != EEXIST) { + print_error("Error: %s\n", strerror(errno)); + } else { // try again: retval = chdir(rootdir); + } } else { print_error("Error: %s\n", strerror(errno)); } |