]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/blockdev-util: shorten the code a bit
authorMike Yuan <me@yhndnzj.com>
Thu, 2 Jan 2025 03:22:46 +0000 (04:22 +0100)
committerMike Yuan <me@yhndnzj.com>
Thu, 2 Jan 2025 14:29:34 +0000 (15:29 +0100)
If btrfs_get_block_device_fd() returns 0, ret is already initialized.

src/shared/blockdev-util.c

index 53d60bd0dd7b99472ee328dddaeb6f8c53a0f32f..57dfe3a19c32e16eb0ace9303e50872397b7a771 100644 (file)
@@ -263,9 +263,7 @@ int get_block_device_fd(int fd, dev_t *ret) {
         }
 
         r = btrfs_get_block_device_fd(fd, ret);
-        if (r > 0)
-                return 1;
-        if (r != -ENOTTY) /* not btrfs */
+        if (r != -ENOTTY) /* ENOTTY: not btrfs */
                 return r;
 
         *ret = 0;