mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
shutdown: use "int" for log level type
Let's remove some unnecessary confusion around signed/unsigned types for log levels. Let's just stick to signed, because that is what glibc generally appears to use. While we are at it, add explicit logging for all error causes.
This commit is contained in:
parent
60cd367649
commit
701f6af6b9
@ -258,7 +258,7 @@ static void sync_with_progress(void) {
|
||||
|
||||
static int read_current_sysctl_printk_log_level(void) {
|
||||
_cleanup_free_ char *sysctl_printk_vals = NULL, *sysctl_printk_curr = NULL;
|
||||
unsigned current_lvl = 0;
|
||||
int current_lvl;
|
||||
const char *p;
|
||||
int r;
|
||||
|
||||
@ -268,13 +268,14 @@ static int read_current_sysctl_printk_log_level(void) {
|
||||
|
||||
p = sysctl_printk_vals;
|
||||
r = extract_first_word(&p, &sysctl_printk_curr, NULL, 0);
|
||||
if (r > 0)
|
||||
r = safe_atou(sysctl_printk_curr, ¤t_lvl);
|
||||
else if (r == 0)
|
||||
r = -EINVAL;
|
||||
|
||||
if (r < 0)
|
||||
return log_debug_errno(r, "Unexpected sysctl kernel.printk content: %s", sysctl_printk_vals);
|
||||
return log_debug_errno(r, "Failed to split out kernel printk priority: %m");
|
||||
if (r == 0)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Short read while reading kernel.printk sysctl");
|
||||
|
||||
r = safe_atoi(sysctl_printk_curr, ¤t_lvl);
|
||||
if (r < 0)
|
||||
return log_debug_errno(r, "Failed to parse kernel.printk sysctl: %s", sysctl_printk_vals);
|
||||
|
||||
return current_lvl;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user