From c8a202b7d47f9d6bba3100a208abdadfc383499e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 13 Feb 2014 14:59:56 +0100 Subject: everywhere: always use O_CLOEXEC where it makes sense --- src/udev/udev-builtin-btrfs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/udev/udev-builtin-btrfs.c') 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; -- cgit v1.2.3-54-g00ecf