[Bug 4520] [RFC] kexecboot: passing extra cmdline arguments

bugzilla-daemon at amethyst.openembedded.net bugzilla-daemon at amethyst.openembedded.net
Sat Aug 30 12:29:32 UTC 2008


http://bugs.openembedded.net/show_bug.cgi?id=4520





--- Comment #15 from Yuri Bushmelev <jay4mail at gmail.com>  2008-08-30 14:29:31 ---
(In reply to comment #14)
> > with only one invocation on snprintf. E.g.:
> > 
> > ---- /code -----
> >     snprintf(command, sizeof(command), "/usr/sbin/kexec
> > --command-line=\"%s%s%croot=%s rootfstype=%s rootwait\" -l %s",
> >         boot->cmdline, extra_cmdline,
> >             (boot->cmdline || '\0' != extra_cmdline[0] ? ' ' : '\0'),
> >         boot->device, boot->fstype, boot->kernelpath);
> > ---- code -----
> Lets be cmdline=foo and extra_cmdline="\0". We get:
> --command-line="foo\0 root=..."

No, appropriate '%s' will be just replaced with empty string in this case. I've
checked. "\0" is just empty null-terminated string.

> We should have better conventions:
> i.e. 
> boot->{cmdline, extra_cmdline, device, fstype, kernelpath}:
> -must not be space prefixed or suffixed and must not contain "\0"
> -must be set to NULL if not set.
> 
> This makes the above simplification impossible right? If you know some better
> way feel free to say so.

Now I have rewritten system call with execve() and fork+execve().
But I'll consider your convention. Space prepending is uncommon and may have
some after-effects.

-- 
Configure bugmail: http://bugs.openembedded.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.




More information about the Openembedded-issues mailing list