On Fri, 01.03.13 18:21, Harald Hoyer (harald.ho...@gmail.com) wrote:

> 
> Am 01.03.2013 18:00, schrieb Lennart Poettering:
> > On Fri, 01.03.13 17:56, Harald Hoyer (har...@redhat.com) wrote:
> > 
> >>
> >> Am 01.03.2013 17:37, schrieb Lennart Poettering:
> >>> On Fri, 01.03.13 15:13, har...@redhat.com (har...@redhat.com) wrote:
> >>>
> >>>> From: Harald Hoyer <har...@redhat.com>
> >>>>
> >>>> If no "ro" or "rw" is specified on the kernel command line, mount root
> >>>> read-only on /sysroot by default
> >>>
> >>> This sounds good, in order to stay in sync with the initrd-less kernel
> >>> logic. Please commit!
> >>>
> >>
> >> committed.
> >>
> >> Btw, strjoin() should really handle empty strings as the first argument.
> >>
> >> strjoin(NULL, ",", "TEST") should result in "TEST" .. shouldn't it?
> >>
> >> strjoin("", ",", "TEST") ?
> > 
> > We use NULL as the sentinel here for the varargs list. It just stupidly
> > concatenates the strings you pass it, one after the other, until we hit
> > NULL. If you pass NULL as first arg, then we'd just stop there...
> > 
> > There's strempty() which turns NULL into ""?
> > 
> > Lennart
> > 
> 
> Still:
> strjoin("", ",", "TEST") returns ",TEST" then..

No, that call will crash, since you forgot the NULL sentinel. Examples:

strjoin("", ",", "TEST", NULL) → ",TEST"
strjoin("a", "b", "c", NULL) → "abc"
strjoin("a", "b", "c", "d", NULL) → "abcd"
strjoin("a", "b", "c", "d", "e", NULL) → "abcde"
strjoin(NULL) → ""
strjoin("", "", "", NULL) → ""
strjoin("abc", "xyz", NULL) → "abcxyz"
strjoin("abc", NULL, "xyz") → "abc"

That's just trivially simple concatenation, ending at the first
NULL. Not sure what you expect instead?

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to