summaryrefslogtreecommitdiff
path: root/src/login/logind-session.c
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/login/logind-session.c
parent895b3a7b44fe7ca2f260986be2a877ff56a72718 (diff)
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/login/logind-session.c')
-rw-r--r--src/login/logind-session.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 5b30457a88..c1800e0854 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -968,7 +968,7 @@ static int session_open_vt(Session *s) {
sprintf(path, "/dev/tty%u", s->vtnr);
s->vtfd = open(path, O_RDWR | O_CLOEXEC | O_NONBLOCK | O_NOCTTY);
if (s->vtfd < 0) {
- log_error("cannot open VT %s of session %s: %m", path, s->id);
+ log_error_errno(errno, "cannot open VT %s of session %s: %m", path, s->id);
return -errno;
}
@@ -989,21 +989,21 @@ int session_prepare_vt(Session *s) {
r = fchown(vt, s->user->uid, -1);
if (r < 0) {
r = -errno;
- log_error("Cannot change owner of /dev/tty%u: %m", s->vtnr);
+ log_error_errno(errno, "Cannot change owner of /dev/tty%u: %m", s->vtnr);
goto error;
}
r = ioctl(vt, KDSKBMODE, K_OFF);
if (r < 0) {
r = -errno;
- log_error("Cannot set K_OFF on /dev/tty%u: %m", s->vtnr);
+ log_error_errno(errno, "Cannot set K_OFF on /dev/tty%u: %m", s->vtnr);
goto error;
}
r = ioctl(vt, KDSETMODE, KD_GRAPHICS);
if (r < 0) {
r = -errno;
- log_error("Cannot set KD_GRAPHICS on /dev/tty%u: %m", s->vtnr);
+ log_error_errno(errno, "Cannot set KD_GRAPHICS on /dev/tty%u: %m", s->vtnr);
goto error;
}
@@ -1016,7 +1016,7 @@ int session_prepare_vt(Session *s) {
r = ioctl(vt, VT_SETMODE, &mode);
if (r < 0) {
r = -errno;
- log_error("Cannot set VT_PROCESS on /dev/tty%u: %m", s->vtnr);
+ log_error_errno(errno, "Cannot set VT_PROCESS on /dev/tty%u: %m", s->vtnr);
goto error;
}
@@ -1073,7 +1073,7 @@ void session_leave_vt(Session *s) {
session_device_pause_all(s);
r = ioctl(s->vtfd, VT_RELDISP, 1);
if (r < 0)
- log_debug("Cannot release VT of session %s: %m", s->id);
+ log_debug_errno(errno, "Cannot release VT of session %s: %m", s->id);
}
bool session_is_controller(Session *s, const char *sender) {