From 35fa2d7acfd439502abcda99dedc354b754fd14c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bojan=20=C4=8Cekrli=C4=87?= Date: Sat, 15 Aug 2020 22:45:49 +0200 Subject: [PATCH] Fix for #30 - Use sleep inifinity instead of sleep Apparently using sleep with very large numbers is not a good idea when your image can be compiled down to 32-bit platforms. This fix uses `sleep infinity` and -- failing that -- tries to sleep for about 68 years (which is exactly 2^15 seconds). --- scripts/opendkim.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/opendkim.sh b/scripts/opendkim.sh index 489af14..b5fa071 100644 --- a/scripts/opendkim.sh +++ b/scripts/opendkim.sh @@ -1,8 +1,17 @@ #!/bin/sh + +noop() { + while true; do + # 2147483647 = max signed 32-bit integer + # 2147483647 s ≅ 70 years + sleep infinity || sleep 2147483647 + done +} + if [ ! -d /etc/opendkim/keys ]; then - sleep 9999999999999999999 + noop elif [ -z "$(find /etc/opendkim/keys -type f ! -name .)" ]; then - sleep 9999999999999999999 + noop else /usr/sbin/opendkim -D -f -x /etc/opendkim/opendkim.conf fi