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
committerLennart Poettering <lennart@poettering.net>2014-02-13 14:59:56 +0100
commitc8a202b7d47f9d6bba3100a208abdadfc383499e (patch)
treed19560cf0723f8e2305170881eb442b5ecb12b0d /src/udev/udev-builtin-btrfs.c
parent955d98c9c1104d469c2989dbfb58f58ee6fe9bdc (diff)
everywhere: always use O_CLOEXEC where it makes sense
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;