[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [PATCH] examples/udhcp/simple.script: fix resolv.conf update if it is a dangling symlink
From: Denys Vlasenko <vda.linux () googlemail ! com>
Date: 2019-04-13 15:21:16
Message-ID: CAK1hOcPheHQ6CHHjN4-SmMKqDY_vb9CfjdEAtJC6Lbo-yab6xw () mail ! gmail ! com
[Download RAW message or body]
Applied, thanks
On Thu, Mar 28, 2019 at 3:29 PM Rolf Eike Beer <eb@emlix.com> wrote:
>
> 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 <eb@emlix.com>
> ---
> 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
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic