1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 09:56:51 +03:00

fstab-generator: use more appropriate checks for swap and device availability

We always should use the same checks when deciding whether swap support
and mounting of devices is supported. Hence, let's make
fstab-generator's logic more similar to the usual logic we follow:

a) Look for /proc/swaps and no container support before activating
swaps.

b) Look for /sys being writable befire supporting device mounts.
This commit is contained in:
Lennart Poettering 2015-01-05 12:35:08 +01:00
parent 6b3fd9a14d
commit 00b4ffdecb

View File

@ -87,6 +87,11 @@ static int add_swap(
assert(what);
assert(me);
if (access("/proc/swaps", F_OK) < 0) {
log_info("Swap not supported, ignoring fstab swap entry for %s.", what);
return 0;
}
if (detect_container(NULL) > 0) {
log_info("Running in a container, ignoring fstab swap entry for %s.", what);
return 0;
@ -355,7 +360,7 @@ static int parse_fstab(bool initrd) {
if (!what)
return log_oom();
if (detect_container(NULL) > 0 && is_device_path(what)) {
if (is_device_path(what) && path_is_read_only_fs("sys") > 0) {
log_info("Running in a container, ignoring fstab device entry for %s.", what);
continue;
}