[Bug 291374] getopt(3) GNU extension wrong behavior

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 11 Jan 2026 16:59:02 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=291374

--- Comment #14 from Simon Wollwage <rootnode+freebsd@wollwage.com> ---
(In reply to Eugene Grosbein from comment #13)

But tricky. Take the '-d' option on tftpd. If space would be allowed, say you
call it with 'tftpd -d 4'. Is 4 now the value given to the debug option or is
it a directory name?

'tftpd' cannot use 'optind < argc' to check if anything was missing.

So, adding the space handling seems difficult. Detecting if the list has been
exhausted is also difficult. I think getopt returning '-1' here is
unfortunately correct.

-- 
You are receiving this mail because:
You are the assignee for the bug.