Fix error checking 75/244675/1 accepted/tizen/unified/20200924.072504 submit/tizen/20200923.074041
authorKichan Kwon <k_c.kwon@samsung.com>
Wed, 23 Sep 2020 06:42:55 +0000 (15:42 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Wed, 23 Sep 2020 06:45:55 +0000 (15:45 +0900)
Change-Id: I0802ef4abdcb5630bfa364f4bdd0805594d831ae
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
src/system-recovery.c

index 199e70524262133d21e6ef71e7956b2a76be1013..28f92c7013acad9c198700924a3eb39ae320989e 100644 (file)
@@ -58,7 +58,6 @@ static unsigned long long total_image_size;
 
 static int find_recovery_image(void)
 {
-       int ret = SUCCEED;
        _CLEANUP_DIR_ DIR *dir = NULL;
        struct dirent *dirent = NULL;
        char path[PATH_MAX - FIELD_LENGTH];
@@ -76,8 +75,9 @@ static int find_recovery_image(void)
 
                        snprintf(path, sizeof(path), "%s/%s/%s",
                                        USB_MOUNTPOINT_ROOT, dirent->d_name, RECOVERY_IMAGE_BASENAME);
-                       ret = access(path, F_OK);
-                       switch (ret) {
+                       errno = 0;
+                       access(path, F_OK);
+                       switch (errno) {
                        case 0:
                                _I("Find recovery image : %s", path);
 
@@ -119,8 +119,9 @@ static int try_launch(const char *argv, ...)
                return EINVAL;
        }
 
-       ret = access(path, F_OK);
-       switch (ret) {
+       errno = 0;
+       access(path, F_OK);
+       switch (errno) {
        case 0:
                _I("Find %s... Try to launch it", path);
                break;