diff options
Diffstat (limited to 'lib/libmtd_legacy.c')
-rw-r--r-- | lib/libmtd_legacy.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/libmtd_legacy.c b/lib/libmtd_legacy.c index ba8eade..46f51fd 100644 --- a/lib/libmtd_legacy.c +++ b/lib/libmtd_legacy.c @@ -146,6 +146,24 @@ static int proc_parse_next(struct proc_parse_info *pi) } /** + * legacy_procfs_is_supported - legacy version of 'sysfs_is_supported()'. + * + * Check if we can access the procfs files for the MTD subsystem. + */ +int legacy_procfs_is_supported(void) +{ + if (access(MTD_PROC_FILE, R_OK) != 0) { + if (errno == ENOENT) { + errno = 0; + } else { + sys_errmsg("cannot read \"%s\"", MTD_PROC_FILE); + } + return 0; + } + return 1; +} + +/** * legacy_dev_presentl - legacy version of 'mtd_dev_present()'. * @info: the MTD device information is returned here * |