peripheral: Fix unchecked return value
authorTedd Ho-Jeong An <tedd.an@intel.com>
Mon, 18 Oct 2021 17:28:33 +0000 (10:28 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:37 +0000 (19:08 +0530)
This patch fixes the unchecked return value(CWE-252) issues reported by
the Coverity.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
peripheral/main.c

index e54ae21367c027b4b04ffddf2f279173fbade1ab..45e103f8dc19f4671b427c9a68a0b65ced3c992d 100755 (executable)
@@ -76,7 +76,8 @@ static void prepare_filesystem(void)
 
                if (lstat(mount_table[i].target, &st) < 0) {
                        printf("Creating %s\n", mount_table[i].target);
-                       mkdir(mount_table[i].target, 0755);
+                       if (mkdir(mount_table[i].target, 0755) < 0)
+                               perror("Failed to create dir");
                }
 
                printf("Mounting %s to %s\n", mount_table[i].fstype,