mirror of
https://github.com/systemd/systemd.git
synced 2025-03-22 06:50:18 +03:00
storagetm: Check if /sys/kernel/config is a mountpoint
Otherwise we'll fail with an unclear error later on so let's check this first before continuing.
This commit is contained in:
parent
1740bbc98b
commit
dc90f083d0
@ -18,6 +18,7 @@
|
||||
#include "local-addresses.h"
|
||||
#include "loop-util.h"
|
||||
#include "main-func.h"
|
||||
#include "mountpoint-util.h"
|
||||
#include "os-util.h"
|
||||
#include "parse-argument.h"
|
||||
#include "path-util.h"
|
||||
@ -1128,6 +1129,14 @@ static int run(int argc, char* argv[]) {
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
/* If systemd-storagetm is invoked outside of it's unit /sys/kernel/config/ might not be mounted yet,
|
||||
* so let's check explicitly whether it is mounted or not. */
|
||||
r = path_is_mount_point("/sys/kernel/config");
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to check if the configfs filesystem is mounted at /sys/kernel/config/: %m");
|
||||
if (r == 0)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(ENOENT), "The configfs filesystem must be mounted at /sys/kernel/config/ to be able to use systemd-storagetm");
|
||||
|
||||
r = sd_event_new(&event);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to allocate event loop: %m");
|
||||
|
Loading…
x
Reference in New Issue
Block a user