If /etc/resolv.conf is a symlink to a tmpfs and the actual file does not already exist, "readlink -f" will not detect it as symlink. Explicitely check for that condition before and touch the file, making the other code work as intended.
Signed-off-by: Rolf Eike Beer <[email protected]> --- examples/udhcp/simple.script | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/udhcp/simple.script b/examples/udhcp/simple.script index 44aa46ece..57fb3e431 100755 --- a/examples/udhcp/simple.script +++ b/examples/udhcp/simple.script @@ -55,6 +55,9 @@ case "$1" in echo "Recreating $RESOLV_CONF" # If the file is a symlink somewhere (like /etc/resolv.conf # pointing to /run/resolv.conf), make sure things work. + if [ -L $RESOLV_CONF -a ! -f $RESOLV_CONF ]; then + touch $RESOLV_CONF + fi realconf=$(readlink -f "$RESOLV_CONF" 2>/dev/null || echo "$RESOLV_CONF") tmpfile="$realconf-$$" > "$tmpfile" -- 2.21.0 -- Rolf Eike Beer, emlix GmbH, http://www.emlix.com Fon +49 551 30664-0, Fax +49 551 30664-11 Gothaer Platz 3, 37083 Göttingen, Germany Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160 Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055 emlix - smart embedded open source _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
