exactness: check success of mkdir
authorStefan Schmidt <s.schmidt@samsung.com>
Wed, 26 Feb 2020 14:07:12 +0000 (15:07 +0100)
committerJongmin Lee <jm105.lee@samsung.com>
Tue, 3 Mar 2020 21:16:58 +0000 (06:16 +0900)
Evaluate return code of mkdir() and print error if it fails.

CID: 1419844

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D11429

src/bin/exactness/exactness.c

index 04301f5..9214236 100644 (file)
@@ -184,7 +184,11 @@ _run_test_compare(const List_Entry *ent)
           {
              char *currentdir;
              sprintf(origdir, "%s/%s/%s", _dest_dir, CURRENT_SUBDIR, ORIG_SUBDIR);
-             mkdir(origdir, 0744);
+             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);
              currentdir = alloca(strlen(_dest_dir) + 20);
@@ -561,7 +565,12 @@ main(int argc, char *argv[])
              ret = 1;
              goto end;
           }
-        mkdir(tmp, 0744);
+        if (mkdir(tmp, 0744) < 0)
+          {
+             fprintf(stderr, "Failed to create dir %s", tmp);
+             ret = 1;
+             goto end;
+          }
      }
    else if (mode_init)
      {
@@ -573,7 +582,12 @@ main(int argc, char *argv[])
              ret = 1;
              goto end;
           }
-        mkdir(tmp, 0744);
+        if (mkdir(tmp, 0744) < 0)
+          {
+             fprintf(stderr, "Failed to create dir %s", tmp);
+             ret = 1;
+             goto end;
+          }
      }
    else if (mode_simulation)
      {