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;
if (!filename)
return NULL;
- fd = open(filename, O_RDONLY);
+ fd = open(filename, O_RDONLY|O_CLOEXEC);
if (fd < 0)
return NULL;
* <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);
* 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;
if (!diskpath)
goto nothing;
- fd = open(diskpath, O_RDONLY);
+ fd = open(diskpath, O_RDONLY|O_CLOEXEC);
free(diskpath);
if (fd == -1)
}
}
- 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,