diff options
author | Jes Sorensen <Jes.Sorensen@gmail.com> | 2017-03-30 22:52:37 +0200 |
---|---|---|
committer | Jes Sorensen <Jes.Sorensen@gmail.com> | 2017-03-30 22:52:37 +0200 |
commit | dae131379f9fd82e2867aed25a3ff719f957e9a3 (patch) | |
tree | f337efe8338f6c9cb58086b274cf7ae32a3cd64c /Assemble.c | |
parent | sysfs: Use the presence of /sys/block/<dev>/md as indicator of valid device (diff) | |
download | mdadm-dae131379f9fd82e2867aed25a3ff719f957e9a3.tar.xz mdadm-dae131379f9fd82e2867aed25a3ff719f957e9a3.zip |
sysfs: Make sysfs_init() return an error code
Rather than have the caller inspect the returned content, return an
error code from sysfs_init(). In addition make all callers actually
check it.
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Diffstat (limited to 'Assemble.c')
-rw-r--r-- | Assemble.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -1670,7 +1670,12 @@ try_again: } st->ss->getinfo_super(st, content, NULL); #ifndef MDASSEMBLE - sysfs_init(content, mdfd, NULL); + if (sysfs_init(content, mdfd, NULL)) { + pr_err("Unable to initialize sysfs\n"); + close(mdfd); + free(devices); + return 1; + } #endif /* after reload context, store journal_clean in context */ content->journal_clean = journal_clean; @@ -1885,7 +1890,10 @@ int assemble_container_content(struct supertype *st, int mdfd, char *avail; int err; - sysfs_init(content, mdfd, NULL); + if (sysfs_init(content, mdfd, NULL)) { + pr_err("Unable to initialize sysfs\n"); + return 1; + } sra = sysfs_read(mdfd, NULL, GET_VERSION|GET_DEVS); if (sra == NULL || strcmp(sra->text_version, content->text_version) != 0) { |