]> err.no Git - systemd/commitdiff
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 8d13f19382070f46ed847b8e8c319df42f13a7e4..09cb560111f1997650a94563d6ca736c9a41df6a 100644 (file)
@@ -29,7 +29,7 @@ CLEANFILES =
 # libudev
 # ------------------------------------------------------------------------------
 LIBUDEV_CURRENT=8
-LIBUDEV_REVISION=0
+LIBUDEV_REVISION=1
 LIBUDEV_AGE=8
 
 SUBDIRS += libudev/docs
index 7e6b7f1ce72c6a2bb4c4e58a538a2fba115c1b6e..5811490a34599cbfdb4078938bda213a33c405fa 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 5a4a3dc095ccf236d106b9ebfba23a58990cdf29..f3cb5ab4986594b4a3e53e93a02508d2858f4160 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 0ae5a9115ac4297828e0dc7cd7aa78226510a446..cd418709f0336b32468bc8aafc2b079d6c5c7936 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;