chiark / gitweb /
libudev: add O_CLOEXEC
authorKay Sievers <kay.sievers@vrfy.org>
Fri, 14 May 2010 12:52:18 +0000 (14:52 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Fri, 14 May 2010 12:52:18 +0000 (14:52 +0200)
Makefile.am
libudev/libudev-device.c
libudev/libudev-queue.c
libudev/libudev.c

index 8d13f19..09cb560 100644 (file)
@@ -29,7 +29,7 @@ CLEANFILES =
 # libudev
 # ------------------------------------------------------------------------------
 LIBUDEV_CURRENT=8
-LIBUDEV_REVISION=0
+LIBUDEV_REVISION=1
 LIBUDEV_AGE=8
 
 SUBDIRS += libudev/docs
index 7e6b7f1..5811490 100644 (file)
@@ -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;
index 5a4a3dc..f3cb5ab 100644 (file)
@@ -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;
 
index 0ae5a91..cd41870 100644 (file)
@@ -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;