From: Karel Zak Date: Wed, 29 Aug 2012 17:49:19 +0000 (+0200) Subject: libblkid: use O_CLOEXEC X-Git-Tag: v2.23-rc1~744 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=49a8f58e48a5b7f5d4852700ecdd317c7b547a74;p=thirdparty%2Futil-linux.git libblkid: use O_CLOEXEC Signed-off-by: Karel Zak --- diff --git a/libblkid/src/evaluate.c b/libblkid/src/evaluate.c index 5a84b43258..52abfae54f 100644 --- a/libblkid/src/evaluate.c +++ b/libblkid/src/evaluate.c @@ -69,7 +69,7 @@ static int verify_tag(const char *devname, const char *name, const char *value) blkid_probe_enable_partitions(pr, TRUE); blkid_probe_set_partitions_flags(pr, BLKID_PARTS_ENTRY_DETAILS); - fd = open(devname, O_RDONLY); + fd = open(devname, O_RDONLY|O_CLOEXEC); if (fd < 0) { errsv = errno; goto done; diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c index 467b1fda85..c371656a49 100644 --- a/libblkid/src/probe.c +++ b/libblkid/src/probe.c @@ -209,7 +209,7 @@ blkid_probe blkid_new_probe_from_filename(const char *filename) if (!filename) return NULL; - fd = open(filename, O_RDONLY); + fd = open(filename, O_RDONLY|O_CLOEXEC); if (fd < 0) return NULL; @@ -934,7 +934,7 @@ int blkid_do_probe(blkid_probe pr) * * wipe all filesystems or raids from the device * - * fd = open(devname, O_RDWR); + * fd = open(devname, O_RDWR|O_CLOEXEC); * blkid_probe_set_device(pr, fd, 0, 0); * * blkid_probe_enable_superblocks(pr, 1); diff --git a/libblkid/src/read.c b/libblkid/src/read.c index 60d13db0cf..d31d024bc5 100644 --- a/libblkid/src/read.c +++ b/libblkid/src/read.c @@ -398,7 +398,7 @@ void blkid_read_cache(blkid_cache cache) * If the file doesn't exist, then we just return an empty * struct so that the cache can be populated. */ - if ((fd = open(cache->bic_filename, O_RDONLY)) < 0) + if ((fd = open(cache->bic_filename, O_RDONLY|O_CLOEXEC)) < 0) return; if (fstat(fd, &st) < 0) goto errout; diff --git a/libblkid/src/topology/md.c b/libblkid/src/topology/md.c index a24fbaca62..5eba94787d 100644 --- a/libblkid/src/topology/md.c +++ b/libblkid/src/topology/md.c @@ -97,7 +97,7 @@ static int probe_md_tp(blkid_probe pr, if (!diskpath) goto nothing; - fd = open(diskpath, O_RDONLY); + fd = open(diskpath, O_RDONLY|O_CLOEXEC); free(diskpath); if (fd == -1) diff --git a/libblkid/src/verify.c b/libblkid/src/verify.c index cbb409607a..cfb989bcc0 100644 --- a/libblkid/src/verify.c +++ b/libblkid/src/verify.c @@ -120,7 +120,7 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev) } } - fd = open(dev->bid_name, O_RDONLY); + fd = open(dev->bid_name, O_RDONLY|O_CLOEXEC); if (fd < 0) { DBG(DEBUG_PROBE, printf("blkid_verify: error %m (%d) while " "opening %s\n", errno,