static int find_recovery_image(void)
{
- int ret = SUCCEED;
_CLEANUP_DIR_ DIR *dir = NULL;
struct dirent *dirent = NULL;
char path[PATH_MAX - FIELD_LENGTH];
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);
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;