summaryrefslogtreecommitdiffstats
path: root/src/udev/udev-builtin-btrfs.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-10-23 11:26:06 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-10-23 11:29:25 +0200
commitd354690e7d0429338cdd1c2cfe1fdd08fc53da9e (patch)
treed973cacc0865e3ddcb222692459bc8d887ebfa09 /src/udev/udev-builtin-btrfs.c
parentudevadm-test-builtin: use find_device() (diff)
downloadsystemd-d354690e7d0429338cdd1c2cfe1fdd08fc53da9e.tar.xz
systemd-d354690e7d0429338cdd1c2cfe1fdd08fc53da9e.zip
udev-builtin: propagate negative errno
Diffstat (limited to 'src/udev/udev-builtin-btrfs.c')
-rw-r--r--src/udev/udev-builtin-btrfs.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/udev/udev-builtin-btrfs.c b/src/udev/udev-builtin-btrfs.c
index 93fc29f56c..4380eb0be4 100644
--- a/src/udev/udev-builtin-btrfs.c
+++ b/src/udev/udev-builtin-btrfs.c
@@ -18,22 +18,22 @@
static int builtin_btrfs(sd_device *dev, int argc, char *argv[], bool test) {
struct btrfs_ioctl_vol_args args = {};
_cleanup_close_ int fd = -1;
- int err;
+ int r;
if (argc != 3 || !streq(argv[1], "ready"))
- return EXIT_FAILURE;
+ return -EINVAL;
fd = open("/dev/btrfs-control", O_RDWR|O_CLOEXEC);
if (fd < 0)
- return EXIT_FAILURE;
+ return -errno;
strscpy(args.name, sizeof(args.name), argv[2]);
- err = ioctl(fd, BTRFS_IOC_DEVICES_READY, &args);
- if (err < 0)
- return EXIT_FAILURE;
+ r = ioctl(fd, BTRFS_IOC_DEVICES_READY, &args);
+ if (r < 0)
+ return -errno;
- udev_builtin_add_property(dev, test, "ID_BTRFS_READY", one_zero(err == 0));
- return EXIT_SUCCESS;
+ udev_builtin_add_property(dev, test, "ID_BTRFS_READY", one_zero(r == 0));
+ return 0;
}
const struct udev_builtin udev_builtin_btrfs = {