tree-wide: when %m is used in log_*, always specify errno explicitly

All those uses were correct, but I think it's better to be explicit.
Using implicit errno is too error prone, and with this change we can require
(in the sense of a style guideline) that the code is always specified.

Helpful query: git grep -n -P 'log_[^s][a-z]+\(.*%m'
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2017-05-19 14:24:03 -04:00
parent 35bca925f9
commit 25f027c5ef
12 changed files with 28 additions and 35 deletions
+4 -8
View File
@@ -631,10 +631,8 @@ static int enumerator_scan_devices_tag(sd_device_enumerator *enumerator, const c
if (!dir) {
if (errno == ENOENT)
return 0;
else {
log_error("sd-device-enumerator: could not open tags directory %s: %m", path);
return -errno;
}
else
return log_error_errno(errno, "sd-device-enumerator: could not open tags directory %s: %m", path);
}
/* TODO: filter away subsystems? */
@@ -758,10 +756,8 @@ static int parent_crawl_children(sd_device_enumerator *enumerator, const char *p
int r = 0;
dir = opendir(path);
if (!dir) {
log_debug("sd-device-enumerate: could not open parent directory %s: %m", path);
return -errno;
}
if (!dir)
return log_debug_errno(errno, "sd-device-enumerate: could not open parent directory %s: %m", path);
FOREACH_DIRENT_ALL(dent, dir, return -errno) {
_cleanup_free_ char *child = NULL;
+1 -2
View File
@@ -195,8 +195,7 @@ int device_set_syspath(sd_device *device, const char *_syspath, bool verify) {
/* this is not a valid device */
return -ENODEV;
log_debug("sd-device: %s does not have an uevent file: %m", syspath);
return -errno;
return log_debug_errno(errno, "sd-device: %s does not have an uevent file: %m", syspath);
}
} else {
/* everything else just needs to be a directory */