summaryrefslogtreecommitdiff
path: root/src/libsystemd-terminal
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-11-28 13:19:16 +0100
committerMichal Schmidt <mschmidt@redhat.com>2014-11-28 13:29:21 +0100
commitda927ba997d68401563b927f92e6e40e021a8e5c (patch)
tree71764cd998aef07b8943c5206c9307a93ba9c528 /src/libsystemd-terminal
parent0a1beeb64207eaa88ab9236787b1cbc2f704ae14 (diff)
treewide: no need to negate errno for log_*_errno()
It corrrectly handles both positive and negative errno values.
Diffstat (limited to 'src/libsystemd-terminal')
-rw-r--r--src/libsystemd-terminal/evcat.c14
-rw-r--r--src/libsystemd-terminal/idev-keyboard.c8
-rw-r--r--src/libsystemd-terminal/modeset.c10
-rw-r--r--src/libsystemd-terminal/subterm.c38
-rw-r--r--src/libsystemd-terminal/sysview.c4
5 files changed, 37 insertions, 37 deletions
diff --git a/src/libsystemd-terminal/evcat.c b/src/libsystemd-terminal/evcat.c
index 08c872ab83..b0b1a197ed 100644
--- a/src/libsystemd-terminal/evcat.c
+++ b/src/libsystemd-terminal/evcat.c
@@ -138,13 +138,13 @@ static int evcat_new(Evcat **out) {
r = sd_pid_get_session(getpid(), &e->session);
if (r < 0) {
- log_error_errno(-r, "Cannot retrieve logind session: %m");
+ log_error_errno(r, "Cannot retrieve logind session: %m");
return r;
}
r = sd_session_get_seat(e->session, &e->seat);
if (r < 0) {
- log_error_errno(-r, "Cannot retrieve seat of logind session: %m");
+ log_error_errno(r, "Cannot retrieve seat of logind session: %m");
return r;
}
@@ -319,14 +319,14 @@ static int evcat_sysview_fn(sysview_context *c, void *userdata, sysview_event *e
evcat_idev_fn,
e);
if (r < 0) {
- log_error_errno(-r, "Cannot create idev session: %m");
+ log_error_errno(r, "Cannot create idev session: %m");
return r;
}
if (e->managed) {
r = sysview_session_take_control(ev->session_add.session);
if (r < 0) {
- log_error_errno(-r, "Cannot request session control: %m");
+ log_error_errno(r, "Cannot request session control: %m");
return r;
}
}
@@ -346,7 +346,7 @@ static int evcat_sysview_fn(sysview_context *c, void *userdata, sysview_event *e
if (type == SYSVIEW_DEVICE_EVDEV) {
r = idev_session_add_evdev(e->idev_session, sysview_device_get_ud(d));
if (r < 0) {
- log_error_errno(-r, "Cannot add evdev device to idev: %m");
+ log_error_errno(r, "Cannot add evdev device to idev: %m");
return r;
}
}
@@ -358,7 +358,7 @@ static int evcat_sysview_fn(sysview_context *c, void *userdata, sysview_event *e
if (type == SYSVIEW_DEVICE_EVDEV) {
r = idev_session_remove_evdev(e->idev_session, sysview_device_get_ud(d));
if (r < 0) {
- log_error_errno(-r, "Cannot remove evdev device from idev: %m");
+ log_error_errno(r, "Cannot remove evdev device from idev: %m");
return r;
}
}
@@ -367,7 +367,7 @@ static int evcat_sysview_fn(sysview_context *c, void *userdata, sysview_event *e
case SYSVIEW_EVENT_SESSION_CONTROL:
r = ev->session_control.error;
if (r < 0) {
- log_error_errno(-r, "Cannot acquire session control: %m");
+ log_error_errno(r, "Cannot acquire session control: %m");
return r;
}
diff --git a/src/libsystemd-terminal/idev-keyboard.c b/src/libsystemd-terminal/idev-keyboard.c
index 2179fd335d..a26a49a80d 100644
--- a/src/libsystemd-terminal/idev-keyboard.c
+++ b/src/libsystemd-terminal/idev-keyboard.c
@@ -377,7 +377,7 @@ static int kbdctx_set_locale(sd_bus *bus, const char *member, sd_bus_message *m,
error:
if (r < 0)
- log_debug_errno(-r, "idev-keyboard: cannot parse locale property from locale1: %m");
+ log_debug_errno(r, "idev-keyboard: cannot parse locale property from locale1: %m");
return r;
}
@@ -448,7 +448,7 @@ static int kbdctx_query_locale(kbdctx *kc) {
return 0;
error:
- log_debug_errno(-r, "idev-keyboard: cannot send GetAll to locale1: %m");
+ log_debug_errno(r, "idev-keyboard: cannot send GetAll to locale1: %m");
return r;
}
@@ -480,7 +480,7 @@ static int kbdctx_locale_props_changed_fn(sd_bus *bus,
return 0;
error:
- log_debug_errno(-r, "idev-keyboard: cannot handle PropertiesChanged from locale1: %m");
+ log_debug_errno(r, "idev-keyboard: cannot handle PropertiesChanged from locale1: %m");
return r;
}
@@ -497,7 +497,7 @@ static int kbdctx_setup_bus(kbdctx *kc) {
kbdctx_locale_props_changed_fn,
kc);
if (r < 0) {
- log_debug_errno(-r, "idev-keyboard: cannot setup locale1 link: %m");
+ log_debug_errno(r, "idev-keyboard: cannot setup locale1 link: %m");
return r;
}
diff --git a/src/libsystemd-terminal/modeset.c b/src/libsystemd-terminal/modeset.c
index 9871e306e4..54faec8fee 100644
--- a/src/libsystemd-terminal/modeset.c
+++ b/src/libsystemd-terminal/modeset.c
@@ -147,13 +147,13 @@ static int modeset_new(Modeset **out) {
r = sd_pid_get_session(getpid(), &m->session);
if (r < 0) {
- log_error_errno(-r, "Cannot retrieve logind session: %m");
+ log_error_errno(r, "Cannot retrieve logind session: %m");
return r;
}
r = sd_session_get_seat(m->session, &m->seat);
if (r < 0) {
- log_error_errno(-r, "Cannot retrieve seat of logind session: %m");
+ log_error_errno(r, "Cannot retrieve seat of logind session: %m");
return r;
}
@@ -310,14 +310,14 @@ static int modeset_sysview_fn(sysview_context *c, void *userdata, sysview_event
modeset_grdev_fn,
m);
if (r < 0) {
- log_error_errno(-r, "Cannot create grdev session: %m");
+ log_error_errno(r, "Cannot create grdev session: %m");
return r;
}
if (m->managed) {
r = sysview_session_take_control(ev->session_add.session);
if (r < 0) {
- log_error_errno(-r, "Cannot request session control: %m");
+ log_error_errno(r, "Cannot request session control: %m");
return r;
}
}
@@ -359,7 +359,7 @@ static int modeset_sysview_fn(sysview_context *c, void *userdata, sysview_event
case SYSVIEW_EVENT_SESSION_CONTROL:
r = ev->session_control.error;
if (r < 0) {
- log_error_errno(-r, "Cannot acquire session control: %m");
+ log_error_errno(r, "Cannot acquire session control: %m");
return r;
}
diff --git a/src/libsystemd-terminal/subterm.c b/src/libsystemd-terminal/subterm.c
index ef112d4014..97a98a9843 100644
--- a/src/libsystemd-terminal/subterm.c
+++ b/src/libsystemd-terminal/subterm.c
@@ -126,7 +126,7 @@ static int output_flush(Output *o) {
len = loop_write(o->fd, o->obuf, o->n_obuf, false);
if (len < 0) {
- log_error_errno(-len, "error: cannot write to TTY (%zd): %m", len);
+ log_error_errno(len, "error: cannot write to TTY (%zd): %m", len);
return len;
}
@@ -157,7 +157,7 @@ static int output_write(Output *o, const void *buf, size_t size) {
len = loop_write(o->fd, buf, size, false);
if (len < 0) {
- log_error_errno(-len, "error: cannot write to TTY (%zd): %m", len);
+ log_error_errno(len, "error: cannot write to TTY (%zd): %m", len);
return len;
}
@@ -612,12 +612,12 @@ static int terminal_winch_fn(sd_event_source *source, const struct signalfd_sigi
if (t->pty) {
r = pty_resize(t->pty, t->output->in_width, t->output->in_height);
if (r < 0)
- log_error_errno(-r, "error: pty_resize() (%d): %m", r);
+ log_error_errno(r, "error: pty_resize() (%d): %m", r);
}
r = term_screen_resize(t->screen, t->output->in_width, t->output->in_height);
if (r < 0)
- log_error_errno(-r, "error: term_screen_resize() (%d): %m", r);
+ log_error_errno(r, "error: term_screen_resize() (%d): %m", r);
terminal_dirty(t);
@@ -657,7 +657,7 @@ static int terminal_write_tmp(Terminal *t) {
for (i = 0; i < num; ++i) {
r = pty_write(t->pty, vec[i].iov_base, vec[i].iov_len);
if (r < 0) {
- log_error_errno(-r, "error: cannot write to PTY (%d): %m", r);
+ log_error_errno(r, "error: cannot write to PTY (%d): %m", r);
return r;
}
}
@@ -726,7 +726,7 @@ static int terminal_io_fn(sd_event_source *source, int fd, uint32_t revents, voi
for (j = 0; j < n_str; ++j) {
type = term_parser_feed(t->parser, &seq, str[j]);
if (type < 0) {
- log_error_errno(-type, "error: term_parser_feed() (%d): %m", type);
+ log_error_errno(type, "error: term_parser_feed() (%d): %m", type);
return type;
}
@@ -778,7 +778,7 @@ static int terminal_pty_fn(Pty *pty, void *userdata, unsigned int event, const v
case PTY_DATA:
r = term_screen_feed_text(t->screen, ptr, size);
if (r < 0) {
- log_error_errno(-r, "error: term_screen_feed_text() (%d): %m", r);
+ log_error_errno(r, "error: term_screen_feed_text() (%d): %m", r);
return r;
}
@@ -857,49 +857,49 @@ static int terminal_new(Terminal **out, int in_fd, int out_fd) {
r = tcsetattr(t->in_fd, TCSANOW, &in_attr);
if (r < 0) {
- log_error_errno(-r, "error: tcsetattr() (%d): %m", r);
+ log_error_errno(r, "error: tcsetattr() (%d): %m", r);
goto error;
}
r = tcsetattr(t->out_fd, TCSANOW, &out_attr);
if (r < 0) {
- log_error_errno(-r, "error: tcsetattr() (%d): %m", r);
+ log_error_errno(r, "error: tcsetattr() (%d): %m", r);
goto error;
}
r = sd_event_default(&t->event);
if (r < 0) {
- log_error_errno(-r, "error: sd_event_default() (%d): %m", r);
+ log_error_errno(r, "error: sd_event_default() (%d): %m", r);
goto error;
}
r = sigprocmask_many(SIG_BLOCK, SIGINT, SIGQUIT, SIGTERM, SIGWINCH, SIGCHLD, -1);
if (r < 0) {
- log_error_errno(-r, "error: sigprocmask_many() (%d): %m", r);
+ log_error_errno(r, "error: sigprocmask_many() (%d): %m", r);
goto error;
}
r = sd_event_add_signal(t->event, NULL, SIGINT, NULL, NULL);
if (r < 0) {
- log_error_errno(-r, "error: sd_event_add_signal() (%d): %m", r);
+ log_error_errno(r, "error: sd_event_add_signal() (%d): %m", r);
goto error;
}
r = sd_event_add_signal(t->event, NULL, SIGQUIT, NULL, NULL);
if (r < 0) {
- log_error_errno(-r, "error: sd_event_add_signal() (%d): %m", r);
+ log_error_errno(r, "error: sd_event_add_signal() (%d): %m", r);
goto error;
}
r = sd_event_add_signal(t->event, NULL, SIGTERM, NULL, NULL);
if (r < 0) {
- log_error_errno(-r, "error: sd_event_add_signal() (%d): %m", r);
+ log_error_errno(r, "error: sd_event_add_signal() (%d): %m", r);
goto error;
}
r = sd_event_add_signal(t->event, NULL, SIGWINCH, terminal_winch_fn, t);
if (r < 0) {
- log_error_errno(-r, "error: sd_event_add_signal() (%d): %m", r);
+ log_error_errno(r, "error: sd_event_add_signal() (%d): %m", r);
goto error;
}
@@ -907,7 +907,7 @@ static int terminal_new(Terminal **out, int in_fd, int out_fd) {
t->is_dirty = true;
r = sd_event_add_time(t->event, &t->frame_timer, CLOCK_MONOTONIC, 0, 0, terminal_frame_timer_fn, t);
if (r < 0) {
- log_error_errno(-r, "error: sd_event_add_time() (%d): %m", r);
+ log_error_errno(r, "error: sd_event_add_time() (%d): %m", r);
goto error;
}
@@ -929,7 +929,7 @@ static int terminal_new(Terminal **out, int in_fd, int out_fd) {
r = term_screen_resize(t->screen, t->output->in_width, t->output->in_height);
if (r < 0) {
- log_error_errno(-r, "error: term_screen_resize() (%d): %m", r);
+ log_error_errno(r, "error: term_screen_resize() (%d): %m", r);
goto error;
}
@@ -952,7 +952,7 @@ static int terminal_run(Terminal *t) {
pid = pty_fork(&t->pty, t->event, terminal_pty_fn, t, t->output->in_width, t->output->in_height);
if (pid < 0) {
- log_error_errno(-pid, "error: cannot fork PTY (%d): %m", pid);
+ log_error_errno(pid, "error: cannot fork PTY (%d): %m", pid);
return pid;
} else if (pid == 0) {
/* child */
@@ -993,7 +993,7 @@ int main(int argc, char *argv[]) {
out:
if (r < 0)
- log_error_errno(-r, "error: terminal failed (%d): %m", r);
+ log_error_errno(r, "error: terminal failed (%d): %m", r);
terminal_free(t);
return -r;
}
diff --git a/src/libsystemd-terminal/sysview.c b/src/libsystemd-terminal/sysview.c
index 2eab289c41..9eb659777a 100644
--- a/src/libsystemd-terminal/sysview.c
+++ b/src/libsystemd-terminal/sysview.c
@@ -1498,7 +1498,7 @@ static int context_scan_fn(sd_event_source *s, void *userdata) {
if (!c->scanned) {
r = context_ld_scan(c);
if (r < 0) {
- log_debug_errno(-r, "sysview: logind scan failed: %m");
+ log_debug_errno(r, "sysview: logind scan failed: %m");
return r;
}
}
@@ -1507,7 +1507,7 @@ static int context_scan_fn(sd_event_source *s, void *userdata) {
if (hashmap_size(c->session_map) > 0) {
r = context_ud_scan(c);
if (r < 0) {
- log_debug_errno(-r, "sysview: udev scan failed: %m");
+ log_debug_errno(r, "sysview: udev scan failed: %m");
return r;
}