Skip to content

Commit

Permalink
shared/machine-pool: fix mkfs.btrfs checking
Browse files Browse the repository at this point in the history
binary_is_good translates ENOENT to 0
See systemd@85eca92e#diff-bcad68c477b6651521e880c40b7a9b40R813
  • Loading branch information
evverx committed Mar 14, 2016
1 parent ed0b16e commit c3b0e5a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/shared/machine-pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,8 @@ int setup_machine_directory(uint64_t size, sd_bus_error *error) {
}

r = mkfs_exists("btrfs");
if (r == -ENOENT) {
log_debug("mkfs.btrfs is missing, cannot create loopback file for /var/lib/machines.");
return 0;
}
if (r == 0)
return sd_bus_error_set_errnof(error, ENOENT, "Cannot set up /var/lib/machines, mkfs.btrfs is missing");
if (r < 0)
return r;

Expand Down

3 comments on commit c3b0e5a

@keszybz
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your fix is correct, but I think it'd be better to simply change mkfs_exists to return -ENOENT. The place you are changing is the only user, and it just looks stupid to change the error code twice.

@evverx
Copy link
Owner Author

@evverx evverx commented on c3b0e5a Mar 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe.
But systemd@85eca92e

  • Rework fsck_exists() and mkfs_exists() to return 1 on success, 0 if
    the implementation is missing and negative on real errors. This is
    more like we do it in other functions.

@keszybz
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

Please sign in to comment.