]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/login/logind-seat.c
logind: do not pass negative number to strerror
[thirdparty/systemd.git] / src / login / logind-seat.c
index f0e5aa1988cf62ac80b1e5e6c51de52a328fd0a8..a6d88f8e7b83c4d98aba4e7c871e4615ecf680bf 100644 (file)
@@ -19,6 +19,7 @@
 #include "stdio-util.h"
 #include "string-util.h"
 #include "terminal-util.h"
+#include "tmpfile-util.h"
 #include "util.h"
 
 int seat_new(Seat** ret, Manager *m, const char *id) {
@@ -166,8 +167,8 @@ int seat_load(Seat *s) {
         return 0;
 }
 
-static int vt_allocate(unsigned int vtnr) {
-        char p[sizeof("/dev/tty") + DECIMAL_STR_MAX(unsigned int)];
+static int vt_allocate(unsigned vtnr) {
+        char p[sizeof("/dev/tty") + DECIMAL_STR_MAX(unsigned)];
         _cleanup_close_ int fd = -1;
 
         assert(vtnr >= 1);
@@ -265,7 +266,7 @@ int seat_set_active(Seat *s, Session *session) {
         return 0;
 }
 
-int seat_switch_to(Seat *s, unsigned int num) {
+int seat_switch_to(Seat *s, unsigned num) {
         /* Public session positions skip 0 (there is only F1-F12). Maybe it
          * will get reassigned in the future, so return error for now. */
         if (num == 0)
@@ -283,7 +284,7 @@ int seat_switch_to(Seat *s, unsigned int num) {
 }
 
 int seat_switch_to_next(Seat *s) {
-        unsigned int start, i;
+        unsigned start, i;
 
         if (s->position_count == 0)
                 return -EINVAL;
@@ -304,7 +305,7 @@ int seat_switch_to_next(Seat *s) {
 }
 
 int seat_switch_to_previous(Seat *s) {
-        unsigned int start, i;
+        unsigned start, i;
 
         if (s->position_count == 0)
                 return -EINVAL;
@@ -324,7 +325,7 @@ int seat_switch_to_previous(Seat *s) {
         return -EINVAL;
 }
 
-int seat_active_vt_changed(Seat *s, unsigned int vtnr) {
+int seat_active_vt_changed(Seat *s, unsigned vtnr) {
         Session *i, *new_active = NULL;
         int r;
 
@@ -375,7 +376,7 @@ int seat_read_active_vt(Seat *s) {
 
         k = read(s->manager->console_active_fd, t, sizeof(t)-1);
         if (k <= 0) {
-                log_error("Failed to read current console: %s", k < 0 ? strerror(-errno) : "EOF");
+                log_error("Failed to read current console: %s", k < 0 ? strerror(errno) : "EOF");
                 return k < 0 ? -errno : -EIO;
         }
 
@@ -419,7 +420,7 @@ int seat_start(Seat *s) {
 }
 
 int seat_stop(Seat *s, bool force) {
-        int r = 0;
+        int r;
 
         assert(s);
 
@@ -429,7 +430,7 @@ int seat_stop(Seat *s, bool force) {
                            "SEAT_ID=%s", s->id,
                            LOG_MESSAGE("Removed seat %s.", s->id));
 
-        seat_stop_sessions(s, force);
+        r = seat_stop_sessions(s, force);
 
         (void) unlink(s->state_file);
         seat_add_to_gc_queue(s);
@@ -459,7 +460,7 @@ int seat_stop_sessions(Seat *s, bool force) {
 
 void seat_evict_position(Seat *s, Session *session) {
         Session *iter;
-        unsigned int pos = session->position;
+        unsigned pos = session->position;
 
         session->position = 0;
 
@@ -481,7 +482,7 @@ void seat_evict_position(Seat *s, Session *session) {
         }
 }
 
-void seat_claim_position(Seat *s, Session *session, unsigned int pos) {
+void seat_claim_position(Seat *s, Session *session, unsigned pos) {
         /* with VTs, the position is always the same as the VTnr */
         if (seat_has_vts(s))
                 pos = session->vtnr;
@@ -497,7 +498,7 @@ void seat_claim_position(Seat *s, Session *session, unsigned int pos) {
 }
 
 static void seat_assign_position(Seat *s, Session *session) {
-        unsigned int pos;
+        unsigned pos;
 
         if (session->position > 0)
                 return;