]> git.ipfire.org Git - thirdparty/util-linux.git/commit
pipesz: merge help/version getopt loop into main loop
authorKarel Zak <kzak@redhat.com>
Mon, 25 May 2026 11:33:34 +0000 (13:33 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 25 May 2026 11:33:34 +0000 (13:33 +0200)
commit47645c455e785857e9d8eb131ea11de6a1df61c3
tree0d832025431098afe30ba63a0ba2ec4be6880d51
parenteee2e7f2cfb158599609fad8d831105d68a6ed8d
pipesz: merge help/version getopt loop into main loop

The main() function scanned command-line options in two passes: the
first pass checked for --help/--version, and the second processed
normal options. When getopt_long encountered an unknown option in the
first pass, it printed an error message. The same error was then
printed again during the second pass, resulting in a duplicate
"unrecognized option" message.

Fix this by merging the first getopt_long loop into the main one,
following the standard util-linux convention.

Fixes: https://github.com/util-linux/util-linux/issues/3817
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/pipesz.c