summaryrefslogtreecommitdiff
path: root/libudev
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2010-05-14 14:52:18 +0200
committerKay Sievers <kay.sievers@vrfy.org>2010-05-14 14:52:18 +0200
commit0c5c48040ac0f4c97f73fb3ac5493cc2d84a963b (patch)
tree314ce681dab98eedf25f7b12c87a0e0575143bca /libudev
parent12d73e9587a8d9a3ab6415183e4e6762315aa85a (diff)
libudev: add O_CLOEXEC
Diffstat (limited to 'libudev')
-rw-r--r--libudev/libudev-device.c6
-rw-r--r--libudev/libudev-queue.c4
-rw-r--r--libudev/libudev.c2
3 files changed, 6 insertions, 6 deletions
diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c
index 7e6b7f1ce7..5811490a34 100644
--- a/libudev/libudev-device.c
+++ b/libudev/libudev-device.c
@@ -279,7 +279,7 @@ int udev_device_read_db(struct udev_device *udev_device)
return 0;
}
- f = fopen(filename, "r");
+ f = fopen(filename, "re");
if (f == NULL) {
dbg(udev_device->udev, "error reading db file %s: %m\n", filename);
return -1;
@@ -339,7 +339,7 @@ int udev_device_read_uevent_file(struct udev_device *udev_device)
return 0;
util_strscpyl(filename, sizeof(filename), udev_device->syspath, "/uevent", NULL);
- f = fopen(filename, "r");
+ f = fopen(filename, "re");
if (f == NULL)
return -1;
udev_device->uevent_loaded = true;
@@ -1164,7 +1164,7 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const
goto out;
/* read attribute value */
- fd = open(path, O_RDONLY);
+ fd = open(path, O_RDONLY|O_CLOEXEC);
if (fd < 0) {
dbg(udev_device->udev, "attribute '%s' can not be opened\n", path);
goto out;
diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c
index 5a4a3dc095..f3cb5ab498 100644
--- a/libudev/libudev-queue.c
+++ b/libudev/libudev-queue.c
@@ -131,7 +131,7 @@ unsigned long long int udev_get_kernel_seqnum(struct udev *udev)
ssize_t len;
util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), "/kernel/uevent_seqnum", NULL);
- fd = open(filename, O_RDONLY);
+ fd = open(filename, O_RDONLY|O_CLOEXEC);
if (fd < 0)
return 0;
len = read(fd, buf, sizeof(buf));
@@ -215,7 +215,7 @@ static FILE *open_queue_file(struct udev_queue *udev_queue, unsigned long long i
FILE *queue_file;
util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue->udev), "/.udev/queue.bin", NULL);
- queue_file = fopen(filename, "r");
+ queue_file = fopen(filename, "re");
if (queue_file == NULL)
return NULL;
diff --git a/libudev/libudev.c b/libudev/libudev.c
index 0ae5a9115a..cd418709f0 100644
--- a/libudev/libudev.c
+++ b/libudev/libudev.c
@@ -146,7 +146,7 @@ struct udev *udev_new(void)
}
if (config_file == NULL)
goto err;
- f = fopen(config_file, "r");
+ f = fopen(config_file, "re");
if (f != NULL) {
char line[UTIL_LINE_SIZE];
int line_nr = 0;