swapfiles: make sure /proc/swaps exists
If CONFIG_SWAP is turned off in the kernel, this file may not exist. In that case, we should not try to read from it. reported-by: <walter@pratyeka.org> X-Gentoo-Bug: 430378 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=430378
This commit is contained in:
parent
c8703354e3
commit
07e848638c
@ -31,6 +31,7 @@ stop()
|
||||
|
||||
case "$RC_UNAME" in
|
||||
Linux)
|
||||
if [ -e /proc/swaps ]; then
|
||||
while read filename type rest; do
|
||||
case "$type" in
|
||||
file) swapoff $filename >/dev/null;;
|
||||
@ -39,6 +40,7 @@ stop()
|
||||
/dev/loop*) swapoff $filename >/dev/null;;
|
||||
esac
|
||||
done < /proc/swaps
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
eend 0
|
||||
|
Loading…
Reference in New Issue
Block a user