[klibc] Re: nfsmount inside kinit

Aaron Griffin aaronmgriffin at gmail.com
Mon May 15 23:49:24 PDT 2006

On 5/12/06, Aaron Griffin <aaronmgriffin at gmail.com> wrote:
> Hey all, bug report time.  I started tracking this down, but am at a
> bit of a loss for time, so I figured I'd report over this list to see
> if anyone else has the time to fix this or at least find the error.
> When calling nfsmount on it's own, say "nfsmount
> /root" it works just fine, however, when calling nfsmount_main from
> within kinit (via nfsroot=), things get wonky.
> I have verified that argc is 3 and argv[1] == "",
> argv[2] == "/root", however, optind seems off-by-one.  After leaving
> the getopt loop, optind is 2, which causes the server check to fail (
> strchr("/root".':') ).  I do not know where or how optind is thrown
> off, and have gotten to this point, but do not have the time to go
> farther.
> If anyone has any ideas, please let me know.  I may have more time to
> test in a few days if this is still unresolved.

Follow up:
getopt is called once in the ip-config code, which leaves optind at
the end value (2 in this case) when getopt is called in the nfsmount
code.  I would assume that klibc's getopt should reset optind in this
case, but if not, setting it to 1 before the nfsmount loop, while
hackish, works here.
I don't consider myself skilled enough to punch holes in your getopt
implementation, so do with this as you will - consider it a bug

Aaron Griffin

More information about the klibc mailing list