summaryrefslogtreecommitdiff
path: root/src/sysusers
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-11-28 19:29:59 +0100
committerMichal Schmidt <mschmidt@redhat.com>2014-11-28 19:49:27 +0100
commit56f64d95763a799ba4475daf44d8e9f72a1bd474 (patch)
tree4c38253c718dc1972b811fa7c01ebfa3c2b7776c /src/sysusers
parent895b3a7b44fe7ca2f260986be2a877ff56a72718 (diff)
downloadsystemd-56f64d95763a799ba4475daf44d8e9f72a1bd474.tar.gz
systemd-56f64d95763a799ba4475daf44d8e9f72a1bd474.tar.bz2
systemd-56f64d95763a799ba4475daf44d8e9f72a1bd474.zip
treewide: use log_*_errno whenever %m is in the format string
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
Diffstat (limited to 'src/sysusers')
-rw-r--r--src/sysusers/sysusers.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
index 845a307ae7..e69a5f58ad 100644
--- a/src/sysusers/sysusers.c
+++ b/src/sysusers/sysusers.c
@@ -226,15 +226,15 @@ static int make_backup(const char *target, const char *x) {
/* Copy over the access mask */
if (fchmod(fileno(dst), st.st_mode & 07777) < 0)
- log_warning("Failed to change mode on %s: %m", backup);
+ log_warning_errno(errno, "Failed to change mode on %s: %m", backup);
if (fchown(fileno(dst), st.st_uid, st.st_gid)< 0)
- log_warning("Failed to change ownership of %s: %m", backup);
+ log_warning_errno(errno, "Failed to change ownership of %s: %m", backup);
ts[0] = st.st_atim;
ts[1] = st.st_mtim;
if (futimens(fileno(dst), ts) < 0)
- log_warning("Failed to fix access and modification time of %s: %m", backup);
+ log_warning_errno(errno, "Failed to fix access and modification time of %s: %m", backup);
if (rename(temp, backup) < 0)
goto fail;
@@ -899,7 +899,7 @@ static int add_user(Item *i) {
return 0;
}
if (!IN_SET(errno, 0, ENOENT)) {
- log_error("Failed to check if user %s already exists: %m", i->name);
+ log_error_errno(errno, "Failed to check if user %s already exists: %m", i->name);
return -errno;
}
@@ -911,7 +911,7 @@ static int add_user(Item *i) {
return -EBADMSG;
}
if (!IN_SET(errno, 0, ENOENT)) {
- log_error("Failed to check if user %s already exists in shadow database: %m", i->name);
+ log_error_errno(errno, "Failed to check if user %s already exists in shadow database: %m", i->name);
return -errno;
}
}
@@ -1057,7 +1057,7 @@ static int add_group(Item *i) {
return 0;
}
if (!IN_SET(errno, 0, ENOENT)) {
- log_error("Failed to check if group %s already exists: %m", i->name);
+ log_error_errno(errno, "Failed to check if group %s already exists: %m", i->name);
return -errno;
}
}
@@ -1731,7 +1731,7 @@ static int read_config_file(const char *fn, bool ignore_enoent) {
}
if (ferror(f)) {
- log_error("Failed to read from file %s: %m", fn);
+ log_error_errno(errno, "Failed to read from file %s: %m", fn);
if (r == 0)
r = -EIO;
}