diff options
Diffstat (limited to 'lib/libmtd.c')
-rw-r--r-- | lib/libmtd.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libmtd.c b/lib/libmtd.c index ecf182f..f0d40a0 100644 --- a/lib/libmtd.c +++ b/lib/libmtd.c @@ -644,13 +644,15 @@ void libmtd_close(libmtd_t desc) int mtd_dev_present(libmtd_t desc, int mtd_num) { struct stat st; struct libmtd *lib = (struct libmtd *)desc; - char file[strlen(lib->mtd) + 10]; if (!lib->sysfs_supported) return legacy_dev_present(mtd_num); + else { + char file[strlen(lib->mtd) + 10]; - sprintf(file, lib->mtd, mtd_num); - return !stat(file, &st); + sprintf(file, lib->mtd, mtd_num); + return !stat(file, &st); + } } int mtd_get_info(libmtd_t desc, struct mtd_info *info) |