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 committed 2022-03-07 14:01:25 +01:00
1 parent f7a1514131
commit 0e695aa0c7
2 files changed
+4 -2

No files matched your search

+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();