Skip to content

community/dhcping: fix endless getopt loop

Petr Fedchenkov requested to merge giggsoff/aports:fix-dhcping into master

With char type we cannot get expected -1 from getopt and never go out of loop of parsing arguments.

How to check:

$ docker run --platform=linux/arm64 -it --rm alpine:edge
Unable to find image 'alpine:edge' locally
edge: Pulling from library/alpine
dd1e6e89ca16: Pull complete 
Digest: sha256:c8420124adc6f31031a88c85f53e1e78f419b1ac46b827fd1d4d0fdae2c7e3aa
Status: Downloaded newer image for alpine:edge
WARNING: image with reference alpine was found but does not match the specified platform: wanted linux/arm64, actual: linux/amd64
/ # apk add dhcping
fetch https://dl-cdn.alpinelinux.org/alpine/edge/main/aarch64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/edge/community/aarch64/APKINDEX.tar.gz
(1/1) Installing dhcping (1.2-r1)
Executing busybox-1.35.0-r6.trigger
OK: 5 MiB in 16 packages
/ # timeout 15 dhcping -s 172.17.0.1 -t 5
Terminated

expected output is no answer as we set timeout of dhcping (-t) to 5 second we should not hit timeout 15.

Signed-off-by: Petr Fedchenkov giggsoff@gmail.com

Merge request reports