On Tue, 31.03.15 11:35, Dave Reisner (d...@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

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

Reply via email to