DBG(DEBUG_CONFIG, fprintf(stderr,
"reading config file: %s.\n", filename));
- f = fopen(filename, "r");
+ f = fopen(filename, "r" UL_CLOEXECSTR);
if (!f) {
DBG(DEBUG_CONFIG, fprintf(stderr,
"%s: does not exist, using built-in default\n", filename));
dev_t ret = 0;
DBG(DEBUG_DEVNAME, printf("opening %s\n", lvm_device));
- if ((lvf = fopen(lvm_device, "r")) == NULL) {
+ if ((lvf = fopen(lvm_device, "r" UL_CLOEXECSTR)) == NULL) {
DBG(DEBUG_DEVNAME, printf("%s: (%d) %m\n", lvm_device, errno));
return 0;
}
FILE *procpt;
char device[110];
- procpt = fopen(PROC_EVMS_VOLUMES, "r");
+ procpt = fopen(PROC_EVMS_VOLUMES, "r" UL_CLOEXECSTR);
if (!procpt)
return 0;
while (fgets(line, sizeof(line), procpt)) {
#endif
ubi_probe_all(cache, only_if_new);
- proc = fopen(PROC_PARTITIONS, "r");
+ proc = fopen(PROC_PARTITIONS, "r" UL_CLOEXECSTR);
if (!proc)
return -BLKID_ERR_PROC;
char buf[128];
int match = 0;
- f = fopen(_PATH_PROC_DEVICES, "r");
+ f = fopen(_PATH_PROC_DEVICES, "r" UL_CLOEXECSTR);
if (!f)
return 0;
snprintf(uevent, sizeof(uevent), "/sys/dev/block/%d:%d/uevent",
major(st.st_rdev), minor(st.st_rdev));
- f = fopen(uevent, "w");
+ f = fopen(uevent, "w" UL_CLOEXECSTR);
if (f) {
rc = 0;
if (fputs(action, f) >= 0)
DBG(DEBUG_CACHE, printf("reading cache file %s\n",
cache->bic_filename));
- file = fdopen(fd, "r");
+ file = fdopen(fd, "r" UL_CLOEXECSTR);
if (!file)
goto errout;
tmp = malloc(strlen(filename) + 8);
if (tmp) {
sprintf(tmp, "%s-XXXXXX", filename);
- fd = mkstemp(tmp);
+ fd = mkostemp(tmp, O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC);
if (fd >= 0) {
if (fchmod(fd, 0644) != 0)
DBG(DEBUG_SAVE, printf("%s: fchmod failed\n", filename));
- else if ((file = fdopen(fd, "w")))
+ else if ((file = fdopen(fd, "w" UL_CLOEXECSTR)))
opened = tmp;
if (!file)
close(fd);
}
if (!file) {
- file = fopen(filename, "w");
+ file = fopen(filename, "w" UL_CLOEXECSTR);
opened = filename;
}
FILE *f;
char buf[80], *cp, *t;
- f = fopen("/proc/filesystems", "r");
+ f = fopen("/proc/filesystems", "r" UL_CLOEXECSTR);
if (!f)
return 0;
while (!feof(f)) {
return 0;
snprintf(buf, sizeof(buf), "/lib/modules/%s/modules.dep", uts.release);
- f = fopen(buf, "r");
+ f = fopen(buf, "r" UL_CLOEXECSTR);
if (!f)
return 0;
break;
}
- stream = fdopen(dmpipe[0], "r");
+ stream = fdopen(dmpipe[0], "r" UL_CLOEXECSTR);
if (!stream)
goto nothing;
break;
}
- stream = fdopen(lvpipe[0], "r");
+ stream = fdopen(lvpipe[0], "r" UL_CLOEXECSTR);
if (!stream)
goto nothing;