1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-12 08:58:20 +03:00

blockdev-util: let's initialize return parameter on success

We document the rule that return values >= 0 of functions are supposed
to indicate success, and that in case of success all return parameters
should be initialized. Let's actually do so.

Just a tiny coding style fix-up.
This commit is contained in:
Lennart Poettering 2018-06-11 12:03:35 +02:00
parent d28b67d46a
commit 66ae5130a0
2 changed files with 4 additions and 1 deletions

View File

@ -81,6 +81,7 @@ int get_block_device(const char *path, dev_t *dev) {
if (F_TYPE_EQUAL(sfs.f_type, BTRFS_SUPER_MAGIC))
return btrfs_get_block_device(path, dev);
*dev = 0;
return 0;
}

View File

@ -277,8 +277,10 @@ int btrfs_get_block_device_fd(int fd, dev_t *dev) {
return -errno;
/* We won't do this for btrfs RAID */
if (fsi.num_devices != 1)
if (fsi.num_devices != 1) {
*dev = 0;
return 0;
}
for (id = 1; id <= fsi.max_id; id++) {
struct btrfs_ioctl_dev_info_args di = {