}
static int vt_default_utf8(void) {
- _cleanup_free_ char *b = NULL;
- int r;
-
/* Read the default VT UTF8 setting from the kernel */
-
- r = read_one_line_file("/sys/module/vt/parameters/default_utf8", &b);
- if (r < 0)
- return r;
-
- return parse_boolean(b);
+ return read_boolean_file("/sys/module/vt/parameters/default_utf8");
}
static int vt_reset_keyboard(int fd) {
#include "journald-console.h"
#include "journald-manager.h"
#include "log.h"
-#include "parse-util.h"
#include "process-util.h"
#include "stdio-util.h"
#include "terminal-util.h"
static int cached_printk_time = -1;
- if (_unlikely_(cached_printk_time < 0)) {
- _cleanup_free_ char *p = NULL;
-
- cached_printk_time =
- read_one_line_file("/sys/module/printk/parameters/time", &p) >= 0
- && parse_boolean(p) > 0;
- }
+ if (_unlikely_(cached_printk_time < 0))
+ cached_printk_time = read_boolean_file("/sys/module/printk/parameters/time") > 0;
return cached_printk_time;
}
#include "sd-dlopen.h"
-#include "alloc-util.h"
#include "fileio.h"
-#include "parse-util.h"
static void *libapparmor_dl = NULL;
if (cached_use >= 0)
return cached_use;
- _cleanup_free_ char *p = NULL;
- r = read_one_line_file("/sys/module/apparmor/parameters/enabled", &p);
+ r = read_boolean_file("/sys/module/apparmor/parameters/enabled");
if (r < 0) {
if (r != -ENOENT)
- log_debug_errno(r, "Failed to read /sys/module/apparmor/parameters/enabled, assuming AppArmor is not available: %m");
+ log_debug_errno(r, "Failed to read and parse /sys/module/apparmor/parameters/enabled, assuming AppArmor is not available: %m");
return (cached_use = false);
}
-
- r = parse_boolean(p);
- if (r < 0)
- log_debug_errno(r, "Failed to parse /sys/module/apparmor/parameters/enabled, assuming AppArmor is not available: %m");
- if (r <= 0)
+ if (r == 0)
return (cached_use = false);
if (dlopen_libapparmor(LOG_DEBUG) < 0)