sd-device: use appropriate error code

This commit is contained in:
Yu Watanabe
2021-02-21 04:40:23 +09:00
parent 66efcbb149
commit 163e0a882c
+4 -4
View File
@@ -1914,13 +1914,13 @@ _public_ int sd_device_get_sysattr_value(sd_device *device, const char *sysattr,
return r;
} else
return -EINVAL;
} else if (S_ISDIR(statbuf.st_mode)) {
} else if (S_ISDIR(statbuf.st_mode))
/* skip directories */
return -EINVAL;
} else if (!(statbuf.st_mode & S_IRUSR)) {
return -EISDIR;
else if (!(statbuf.st_mode & S_IRUSR))
/* skip non-readable files */
return -EPERM;
} else {
else {
/* read attribute value */
r = read_full_virtual_file(path, &value, NULL);
if (r < 0)