if (!imagepath)
return 0;
- else
- ipath = strdup(imagepath);
+ else if (!(ipath = strdup(imagepath)))
+ return 0;
if (defdevice)
defdev = strdup(defdevice);
if ((ptr = strrchr(defdev, ':')) != NULL)
*ptr = 0; /* remove trailing : from defdevice if necessary */
}
+ } else {
+ return 0;
}
/* if there is no : then there is no filename or partition. must
} else if (strlen(ipath)) {
result->file = strdup(ipath);
} else {
+ free(defdev);
return 0;
}
free(ipath);
if (defdev)
- free(defdev);
+ free(defdev);
return 1;
}
p->part_number, p->part_start, p->part_size );
if (partition == -1) {
file->fs = fs_open( file, dev_name, p, file_name );
- if (file->fs != FILE_ERR_OK)
- goto bail;
+ if (file->fs == NULL || fserrorno != FILE_ERR_OK)
+ continue;
+ else {
+ partition = p->part_number;
+ goto done;
+ }
}
if ((partition >= 0) && (partition == p->part_number))
found = p;
DEBUG_F( "Using OF defaults.. (found = %p)\n", found );
file->fs = fs_open( file, dev_name, found, file_name );
-bail:
+done:
if (parts)
partitions_free(parts);