X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Ffstab-generator%2Ffstab-generator.c;h=496657bdc176a25b170788d8304bf306ceff5b1b;hp=1f345949289902270a98adaa96b478702a689db9;hb=00b4ffdecbb39d849af65c0ab741be482325a4a9;hpb=6b3fd9a14d378a35d95ec4be65065708d092bee2 diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c index 1f3459492..496657bdc 100644 --- a/src/fstab-generator/fstab-generator.c +++ b/src/fstab-generator/fstab-generator.c @@ -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; }