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,14 +31,16 @@ stop()
|
|||||||
|
|
||||||
case "$RC_UNAME" in
|
case "$RC_UNAME" in
|
||||||
Linux)
|
Linux)
|
||||||
while read filename type rest; do
|
if [ -e /proc/swaps ]; then
|
||||||
case "$type" in
|
while read filename type rest; do
|
||||||
file) swapoff $filename >/dev/null;;
|
case "$type" in
|
||||||
esac
|
file) swapoff $filename >/dev/null;;
|
||||||
case "$filename" in
|
esac
|
||||||
/dev/loop*) swapoff $filename >/dev/null;;
|
case "$filename" in
|
||||||
esac
|
/dev/loop*) swapoff $filename >/dev/null;;
|
||||||
done < /proc/swaps
|
esac
|
||||||
|
done < /proc/swaps
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
eend 0
|
eend 0
|
||||||
|
Loading…
Reference in New Issue
Block a user