From 624ea389c932271fffbc260ada29a2dbadd51603 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Fri, 27 Mar 2020 18:43:42 +0100 Subject: exactness: correctly call mkdir we should not error when mkdir returns < 0. EEXIST should not result in the return here. Reviewed-by: Stefan Schmidt Reviewed-by: Mike Blumenkrantz Differential Revision: https://phab.enlightenment.org/D11618 --- src/bin/exactness/exactness.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/bin/exactness/exactness.c b/src/bin/exactness/exactness.c index 79fefa8330..8338c12cd5 100644 --- a/src/bin/exactness/exactness.c +++ b/src/bin/exactness/exactness.c @@ -170,10 +170,13 @@ _run_test_compare(const List_Entry *ent) { char *currentdir; sprintf(origdir, "%s/%s/%s", _dest_dir, CURRENT_SUBDIR, ORIG_SUBDIR); - if (mkdir(origdir, 0744) < 0) + if (!ecore_file_exists(origdir)) { - fprintf(stderr, "Failed to create dir %s\n", origdir); - return; + if (mkdir(origdir, 0744) < 0) + { + fprintf(stderr, "Failed to create dir %s\n", origdir); + return; + } } _exu_imgs_unpack(path, origdir, ent->name); sprintf(path, "%s/%s/%s.exu", _dest_dir, CURRENT_SUBDIR, ent->name); @@ -536,11 +539,14 @@ main(int argc, char *argv[]) ret = 1; goto end; } - if (mkdir(tmp, 0744) < 0) + if (!ecore_file_exists(tmp)) { - fprintf(stderr, "Failed to create dir %s", tmp); - ret = 1; - goto end; + if (mkdir(tmp, 0744) < 0) + { + fprintf(stderr, "Failed to create dir %s", tmp); + ret = 1; + goto end; + } } } else if (mode_init) @@ -553,11 +559,14 @@ main(int argc, char *argv[]) ret = 1; goto end; } - if (mkdir(tmp, 0744) < 0) + if (!ecore_file_exists(tmp)) { - fprintf(stderr, "Failed to create dir %s", tmp); - ret = 1; - goto end; + if (mkdir(tmp, 0744) < 0) + { + fprintf(stderr, "Failed to create dir %s", tmp); + ret = 1; + goto end; + } } } else if (mode_simulation) -- cgit v1.2.1