diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libudev/libudev-queue-private.c | 2 | ||||
-rw-r--r-- | src/udev/cdrom_id/cdrom_id.c | 2 | ||||
-rw-r--r-- | src/udev/keymap/keymap.c | 6 | ||||
-rw-r--r-- | src/udev/scsi_id/scsi_id.c | 2 | ||||
-rw-r--r-- | src/udev/udev-event.c | 2 | ||||
-rw-r--r-- | src/udev/udev-rules.c | 8 | ||||
-rw-r--r-- | src/udev/udevd.c | 8 |
7 files changed, 15 insertions, 15 deletions
diff --git a/src/libudev/libudev-queue-private.c b/src/libudev/libudev-queue-private.c index 3df99bef3a..367395d984 100644 --- a/src/libudev/libudev-queue-private.c +++ b/src/libudev/libudev-queue-private.c @@ -212,7 +212,7 @@ static int rebuild_queue_file(struct udev_queue_export *udev_queue_export) } /* create new queue file */ - new_queue_file = fopen("/run/udev/queue.tmp", "w+"); + new_queue_file = fopen("/run/udev/queue.tmp", "w+e"); if (new_queue_file == NULL) goto error; seqnum = udev_queue_export->seqnum_max; diff --git a/src/udev/cdrom_id/cdrom_id.c b/src/udev/cdrom_id/cdrom_id.c index a199dd7ddc..74c5165e2a 100644 --- a/src/udev/cdrom_id/cdrom_id.c +++ b/src/udev/cdrom_id/cdrom_id.c @@ -125,7 +125,7 @@ static bool is_mounted(const char *device) if (stat(device, &statbuf) < 0) return -ENODEV; - fp = fopen("/proc/self/mountinfo", "r"); + fp = fopen("/proc/self/mountinfo", "re"); if (fp == NULL) return -ENOSYS; while (fscanf(fp, "%*s %*s %i:%i %*[^\n]", &maj, &min) == 2) { diff --git a/src/udev/keymap/keymap.c b/src/udev/keymap/keymap.c index a2e43f92c0..051aa42552 100644 --- a/src/udev/keymap/keymap.c +++ b/src/udev/keymap/keymap.c @@ -410,7 +410,7 @@ int main(int argc, char **argv) const char *filearg = argv[optind+1]; if (strchr(filearg, '/')) { /* Keymap file argument is a path */ - FILE *f = fopen(filearg, "r"); + FILE *f = fopen(filearg, "re"); if (f) merge_table(fd, f); else @@ -421,12 +421,12 @@ int main(int argc, char **argv) char keymap_path[PATH_MAX]; FILE *f; snprintf(keymap_path, sizeof(keymap_path), "%s%s", SYSCONFDIR "/udev/keymaps/", filearg); - f = fopen(keymap_path, "r"); + f = fopen(keymap_path, "re"); if (f) { merge_table(fd, f); } else { snprintf(keymap_path, sizeof(keymap_path), "%s%s", UDEVLIBEXECDIR "/keymaps/", filearg); - f = fopen(keymap_path, "r"); + f = fopen(keymap_path, "re"); if (f) merge_table(fd, f); else diff --git a/src/udev/scsi_id/scsi_id.c b/src/udev/scsi_id/scsi_id.c index dd8517ba96..6fc41e94fb 100644 --- a/src/udev/scsi_id/scsi_id.c +++ b/src/udev/scsi_id/scsi_id.c @@ -180,7 +180,7 @@ static int get_file_options(struct udev *udev, int c; int retval = 0; - fd = fopen(config_file, "r"); + fd = fopen(config_file, "re"); if (fd == NULL) { if (errno == ENOENT) { return 1; diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c index e6f405b74a..aff14878a7 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c @@ -750,7 +750,7 @@ static void rename_netif_kernel_log(struct ifreq ifr) int klog; FILE *f; - klog = open("/dev/kmsg", O_WRONLY); + klog = open("/dev/kmsg", O_WRONLY|O_CLOEXEC); if (klog < 0) return; diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index b5b54dd043..c571c82877 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -745,7 +745,7 @@ static int import_file_into_properties(struct udev_device *dev, const char *file FILE *f; char line[UTIL_LINE_SIZE]; - f = fopen(filename, "r"); + f = fopen(filename, "re"); if (f == NULL) return -1; while (fgets(line, sizeof(line), f) != NULL) @@ -1645,7 +1645,7 @@ static int parse_file(struct udev_rules *rules, const char *filename) } log_debug("read rules file: %s\n", filename); - f = fopen(filename, "r"); + f = fopen(filename, "re"); if (f == NULL) return -1; @@ -2322,7 +2322,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event FILE *f; bool imported = false; - f = fopen("/proc/cmdline", "r"); + f = fopen("/proc/cmdline", "re"); if (f != NULL) { char cmdline[4096]; @@ -2607,7 +2607,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event log_debug("ATTR '%s' writing '%s' %s:%u\n", attr, value, &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - f = fopen(attr, "w"); + f = fopen(attr, "we"); if (f != NULL) { if (fprintf(f, "%s", value) <= 0) log_error("error writing ATTR{%s}: %m\n", attr); diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 393e2a920c..176e4e2930 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -807,7 +807,7 @@ static void static_dev_create_from_modules(struct udev *udev) uname(&kernel); util_strscpyl(modules, sizeof(modules), ROOTPREFIX "/lib/modules/", kernel.release, "/modules.devname", NULL); - f = fopen(modules, "r"); + f = fopen(modules, "re"); if (f == NULL) return; @@ -871,7 +871,7 @@ static int mem_size_mb(void) char buf[4096]; long int memsize = -1; - f = fopen("/proc/meminfo", "r"); + f = fopen("/proc/meminfo", "re"); if (f == NULL) return -1; @@ -907,7 +907,7 @@ static int convert_db(struct udev *udev) if (access(filename, F_OK) < 0) return 0; - f = fopen("/dev/kmsg", "w"); + f = fopen("/dev/kmsg", "we"); if (f != NULL) { fprintf(f, "<30>systemd-udevd[%u]: converting old udev database\n", getpid()); fclose(f); @@ -1264,7 +1264,7 @@ int main(int argc, char *argv[]) sd_notify(1, "READY=1"); } - f = fopen("/dev/kmsg", "w"); + f = fopen("/dev/kmsg", "we"); if (f != NULL) { fprintf(f, "<30>systemd-udevd[%u]: starting version " VERSION "\n", getpid()); fclose(f); |