diff options
-rw-r--r-- | Assemble.c | 3 | ||||
-rw-r--r-- | Grow.c | 5 | ||||
-rw-r--r-- | Incremental.c | 4 | ||||
-rw-r--r-- | mdadm.c | 3 | ||||
-rw-r--r-- | super-ddf.c | 2 |
5 files changed, 6 insertions, 11 deletions
@@ -569,8 +569,7 @@ static int select_devices(struct mddev_dev *devlist, if (dfd < 0 || st->ss->load_super(st, dfd, NULL)) tmpdev->used = 2; - if (dfd > 0) - close(dfd); + close_fd(&dfd); } } @@ -2334,10 +2334,7 @@ size_change_error: * number of devices (On-Line Capacity Expansion) must be * performed at the level of the container */ - if (fd > 0) { - close(fd); - fd = -1; - } + close_fd(&fd); rv = reshape_container(container, devname, -1, st, &info, c->force, c->backup_file, c->verbose, 0, 0, 0); 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 || @@ -1770,8 +1770,7 @@ int main(int argc, char *argv[]) } if (locked) cluster_release_dlmlock(); - if (mdfd > 0) - close(mdfd); + close_fd(&mdfd); exit(rv); } diff --git a/super-ddf.c b/super-ddf.c index d334a79d..3f304cdc 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -4914,7 +4914,7 @@ static int raid10_degraded(struct mdinfo *info) pr_err("BUG: invalid raid disk\n"); goto out; } - if (d->state_fd > 0) + if (is_fd_valid(d->state_fd)) found[i]++; } ret = 2; |