dphys-swapfile (20061020-3) check-for-empty-or-zero-maxswap.diff

Summary

 dphys-swapfile |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

    
download this patch

Patch contents

Do not apply limit if limit is empty or set to zero.

Index: dphys-swapfile-20061020/dphys-swapfile
===================================================================
--- dphys-swapfile-20061020.orig/dphys-swapfile	2010-05-05 20:33:48.000000000 +0200
+++ dphys-swapfile-20061020/dphys-swapfile	2010-05-05 20:33:53.000000000 +0200
@@ -59,7 +59,9 @@
     echo -n "want ${CONF_SWAPFILE}=${CONF_SWAPSIZE}MByte"
 
     # check for legitimate swap size and restrict to it
-    if [ "${CONF_SWAPSIZE}" -gt "${CONF_MAXSWAP}" ] ; then
+    if [ -n "${CONF_MAXSWAP}" ] && \
+       [ "${CONF_MAXSWAP}" != "0" ] && \
+       [ "${CONF_SWAPSIZE}" -gt "${CONF_MAXSWAP}" ] ; then
       echo -n ", limiting to ${CONF_MAXSWAP}MBytes as configured"
       CONF_SWAPSIZE="${CONF_MAXSWAP}"
     fi