sd-id128: return -ENOMEDIUM on null id
We currently return -ENOMEDIUM when /etc/machine-id is empty, and -EINVAL when it is all zeros. But -EINVAL is also used for invalid args. The distinction between empty and all-zero is not very important, let's use the same return code. Also document -ENOENT and -ENOMEDIUM since they can be a bit surprising.
This commit is contained in:
@@ -98,7 +98,7 @@ _public_ int sd_id128_get_machine(sd_id128_t *ret) {
|
||||
return r;
|
||||
|
||||
if (sd_id128_is_null(saved_machine_id))
|
||||
return -EINVAL;
|
||||
return -ENOMEDIUM;
|
||||
}
|
||||
|
||||
*ret = saved_machine_id;
|
||||
|
||||
Reference in New Issue
Block a user