tree-wise: several cleanups for logging
- drop unnecessary SYNTHETIC_ERRNO() when the logger does not propagate error code, - drop unnecessary '%m' in error message when the error code is specified with SYNTHETIC_ERRNO(), - add missing full stop at the end of log message, - use RET_GATHER(), - add missing ", ignoring.", - upeercase the first letter, etc., etc...
This commit is contained in:
@@ -19,7 +19,7 @@ TEST(log_device_full) {
|
||||
r = log_device_full_errno(dev, level, 0, "test level=%d errno=0: %m", level);
|
||||
assert_se(r == 0);
|
||||
|
||||
r = log_device_full_errno(dev, level, SYNTHETIC_ERRNO(ENODATA), "test level=%d errno=S(ENODATA): %m", level);
|
||||
r = log_device_full_errno(dev, level, SYNTHETIC_ERRNO(ENODATA), "test level=%d errno=S(ENODATA).", level);
|
||||
assert_se(r == -ENODATA);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,15 +313,15 @@ static int hwdb_new(const char *path, sd_hwdb **ret) {
|
||||
|
||||
if (!hwdb->f)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(ENOENT),
|
||||
"hwdb.bin does not exist, please run 'systemd-hwdb update'");
|
||||
"hwdb.bin does not exist, please run 'systemd-hwdb update'.");
|
||||
}
|
||||
|
||||
if (fstat(fileno(hwdb->f), &hwdb->st) < 0)
|
||||
return log_debug_errno(errno, "Failed to stat %s: %m", path);
|
||||
if (hwdb->st.st_size < (off_t) offsetof(struct trie_header_f, strings_len) + 8)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "File %s is too short: %m", path);
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "File %s is too short.", path);
|
||||
if (file_offset_beyond_memory_size(hwdb->st.st_size))
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EFBIG), "File %s is too long: %m", path);
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EFBIG), "File %s is too long.", path);
|
||||
|
||||
hwdb->map = mmap(0, hwdb->st.st_size, PROT_READ, MAP_SHARED, fileno(hwdb->f), 0);
|
||||
if (hwdb->map == MAP_FAILED)
|
||||
@@ -330,7 +330,7 @@ static int hwdb_new(const char *path, sd_hwdb **ret) {
|
||||
if (memcmp(hwdb->map, sig, sizeof(hwdb->head->signature)) != 0 ||
|
||||
(size_t) hwdb->st.st_size != le64toh(hwdb->head->file_size))
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"Failed to recognize the format of %s", path);
|
||||
"Failed to recognize the format of %s.", path);
|
||||
|
||||
log_debug("=== trie on-disk ===");
|
||||
log_debug("tool version: %"PRIu64, le64toh(hwdb->head->tool_version));
|
||||
|
||||
Reference in New Issue
Block a user