]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: use O_CLOEXEC
authorKarel Zak <kzak@redhat.com>
Wed, 29 Aug 2012 17:49:19 +0000 (19:49 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 4 Sep 2012 14:49:28 +0000 (16:49 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/evaluate.c
libblkid/src/probe.c
libblkid/src/read.c
libblkid/src/topology/md.c
libblkid/src/verify.c

index 5a84b432580a53b41af3ed804270d1178a3edefb..52abfae54fc0ec5e3f1592359ae16ce70729f5a6 100644 (file)
@@ -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;
index 467b1fda85a02d05672d60ed59ef2d8f5f491a23..c371656a4972b1ebc4ad7ae1558282538baf6fa5 100644 (file)
@@ -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)
  *  <example>
  *  <title>wipe all filesystems or raids from the device</title>
  *   <programlisting>
- *      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);
index 60d13db0cfb09f31251cd53e7a96d9891a69bdf2..d31d024bc5c02fd8103138e5b9ba7c22f850ba4c 100644 (file)
@@ -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;
index a24fbaca62b89ff35c28cc2a86fbe2057950626d..5eba94787dce0194a3fd7a0010ebe095b3fb877a 100644 (file)
@@ -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)
index cbb409607a5dc993ed6cc7fd2d7aa04c012d7e52..cfb989bcc008b15c4acb47a51470f7fcb0d39072 100644 (file)
@@ -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,