Only run swapon/swapoff if they exist

To silence warnings at startup/shutdown, check for existance of swapon
and swapoff before calling them.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2022-03-07 14:01:25 +01:00
parent f7a1514131
commit 0e695aa0c7
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -333,7 +333,8 @@ static void fs_mount_all(void)
_d("Calling extra mount hook, after mount -a ...");
plugin_run_hooks(HOOK_MOUNT_POST);
run("swapon -ea", "swapon");
if (whichp("swapon"))
run("swapon -ea", "swapon");
_d("Finalize, ensure common file systems are available ...");
fs_finalize();
+2 -1
View File
@@ -321,7 +321,8 @@ void do_shutdown(shutop_t op)
/* Unmount any tmpfs before unmounting swap ... */
unmount_tmpfs();
run("swapoff -e -a", "swapoff");
if (whichp("swapoff"))
run("swapoff -e -a", "swapoff");
/* ... unmount remaining regular file systems. */
unmount_regular();