[systemd-devel] [PATCH] fstab-generator: default to "ro"

Lennart Poettering lennart at poettering.net
Fri Mar 1 09:31:47 PST 2013


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

> 
> Am 01.03.2013 18:00, schrieb Lennart Poettering:
> > On Fri, 01.03.13 17:56, Harald Hoyer (harald at redhat.com) wrote:
> > 
> >>
> >> Am 01.03.2013 17:37, schrieb Lennart Poettering:
> >>> On Fri, 01.03.13 15:13, harald at redhat.com (harald at redhat.com) wrote:
> >>>
> >>>> From: Harald Hoyer <harald at 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.


More information about the systemd-devel mailing list