/* If that didn't work, generate a random machine id */
r = sd_id128_randomize(&buf);
- if (r < 0) {
- log_error("Failed to open /dev/urandom: %s", strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to open /dev/urandom: %m");
for (p = buf.bytes, q = id; p < buf.bytes + sizeof(buf); p++, q += 2) {
q[0] = hexchar(*p >> 4);
r = write_string_file(run_machine_id, id);
}
if (r < 0) {
- log_error("Cannot write %s: %s", run_machine_id, strerror(-r));
+ log_error_errno(r, "Cannot write %s: %m", run_machine_id);
unlink(run_machine_id);
return r;
}