diff options
author | Mateusz Grzonka <mateusz.grzonka@intel.com> | 2021-11-24 11:48:33 +0100 |
---|---|---|
committer | Jes Sorensen <jsorensen@fb.com> | 2021-11-24 13:07:12 +0100 |
commit | b71de056cec70784ef2727e2febd7a6c88e580db (patch) | |
tree | a9c39829732f54c378dcd334b78097e8e4a17c6e /Incremental.c | |
parent | Incremental: Close unclosed mdfd in IncrementalScan() (diff) | |
download | mdadm-b71de056cec70784ef2727e2febd7a6c88e580db.tar.xz mdadm-b71de056cec70784ef2727e2febd7a6c88e580db.zip |
Correct checking if file descriptors are valid
In some cases file descriptors equal to 0 are treated as invalid.
Fix it.
Signed-off-by: Mateusz Grzonka <mateusz.grzonka@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to 'Incremental.c')
-rw-r--r-- | Incremental.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Incremental.c b/Incremental.c index 9cdd31f0..a57fc323 100644 --- a/Incremental.c +++ b/Incremental.c @@ -1702,8 +1702,8 @@ int IncrementalRemove(char *devname, char *id_path, int verbose) return 1; } mdfd = open_dev_excl(ent->devnm); - if (mdfd > 0) { - close(mdfd); + if (is_fd_valid(mdfd)) { + close_fd(&mdfd); if (sysfs_get_str(&mdi, NULL, "array_state", buf, sizeof(buf)) > 0) { if (strncmp(buf, "active", 6) == 0 || |