[systemd-devel] [PATCH] [PATCH v3] nspawn: fallback on bind mount when mknod fails
Dave Reisner
d at falconindy.com
Tue Mar 31 10:32:13 PDT 2015
On Tue, Mar 31, 2015 at 07:14:26PM +0200, Lennart Poettering wrote:
> On Tue, 31.03.15 11:35, Dave Reisner (d at falconindy.com) wrote:
>
> > > + /* Some systems abusively restrict mknod but
> > > + * allow bind mounts. */
> > > + r = touch(to);
> > > + if (r < 0)
> > > + return log_error_errno(r, "touch (%s) failed: %m", to);
> >
> > Is this really what you wanted? It's not obvious that errno will have
> > the correct value when %m is evaluated. I would have used strerror(-r)
> > here.
>
> No. The log_error_errno() macro will set errno explicitly before
> invoking sprintf() to resolve %m, so that %m actually maps to the
> passed error instead of the original errno.
>
> In fact, I really recommend against strerror() since it is not
> thread-safe. Whenever possible we should use the %m thing like in
> Alban's patch. And if that's not appropriate then we should use
> strerror_r() instead of strerror().
>
> Lennart
My mistake -- thanks for clarifying.
More information about the systemd-devel
mailing list