summaryrefslogtreecommitdiff
path: root/src/udev/udev-builtin-btrfs.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-02-13 14:59:56 +0100
committerAnthony G. Basile <blueness@gentoo.org>2014-02-21 10:05:34 -0500
commit4e918b7253bd541a76d3d9641d0be86dd8e132d3 (patch)
tree8839977cdc60aa636d33082a8816e7e934c0bfb4 /src/udev/udev-builtin-btrfs.c
parent9fa108ac48c9b76111589967184436bf63109731 (diff)
everywhere: always use O_CLOEXEC where it makes sense
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/udev/udev-builtin-btrfs.c')
-rw-r--r--src/udev/udev-builtin-btrfs.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/udev/udev-builtin-btrfs.c b/src/udev/udev-builtin-btrfs.c
index f7bea69b26..2baafe6131 100644
--- a/src/udev/udev-builtin-btrfs.c
+++ b/src/udev/udev-builtin-btrfs.c
@@ -38,19 +38,18 @@ struct btrfs_ioctl_vol_args {
static int builtin_btrfs(struct udev_device *dev, int argc, char *argv[], bool test)
{
struct btrfs_ioctl_vol_args args;
- int fd;
+ _cleanup_close_ int fd = -1;
int err;
if (argc != 3 || !streq(argv[1], "ready"))
return EXIT_FAILURE;
- fd = open("/dev/btrfs-control", O_RDWR);
+ fd = open("/dev/btrfs-control", O_RDWR|O_CLOEXEC);
if (fd < 0)
return EXIT_FAILURE;
strscpy(args.name, sizeof(args.name), argv[2]);
err = ioctl(fd, BTRFS_IOC_DEVICES_READY, &args);
- close(fd);
if (err < 0)
return EXIT_FAILURE;