On Tue, 31.03.15 16:51, Alban Crequy (alban.cre...@gmail.com) wrote: > - if (mknod(to, st.st_mode, st.st_rdev) < 0) > - return log_error_errno(errno, "mknod(%s) > failed: %m", to); > + if (mknod(to, st.st_mode, st.st_rdev) < 0) { > + if (errno != EPERM) > + return log_error_errno(errno, > "mknod(%s) failed: %m", to); > + > + /* Some systems abusively restrict mknod but > + * allow bind mounts. */ > + if (touch(to) < 0) > + return > - log_error_errno(errno, "touch (%s) > - failed: %m", to);
touch() is our call, please use its return code for showing the error, not errno. For our own calls we exclusively use kernel-style error handling by returning -errno, while not making any guarantees on errno being set. Hence: whenever you invoke a naked syscall, use errno, if you use one of our own calls use the negative return code. > + if (mount(from, to, NULL, MS_BIND, NULL) < 0) > + return log_error_errno(errno, "both > mknod and bind mount (%s) failed: %m", to); Nitpick: Could you uppercase the "B" in "both", please? It's the beginning of a sentence, and not a syscall name or so... > - if (mknod(to, (st.st_mode & ~07777) | 0600, st.st_rdev) < 0) > - return log_error_errno(errno, "mknod() for /dev/console > failed: %m"); > + if (touch(to) < 0) > + return log_error_errno(errno, "touch() for > - /dev/console failed: %m"); Same here, as above. Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel