diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2013-11-28 17:05:34 +0100 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2013-11-28 17:38:16 +0100 |
commit | 92bd5ff3a062c3f9475b9d9d39b9335bfeb7705e (patch) | |
tree | 0769b098958778286b006da515dca801c64e30d3 /src/login/logind-dbus.c | |
parent | 92fe133abf2de889659464ae8affd1db1710f72e (diff) |
logind: make VT numbers unsigned
Fix the whole code to use "unsigned int" for vtnr. 0 is an invalid vtnr so
we don't need negative numbers at all.
Note that most code already assumes it's unsigned so in case there's a
negative vtnr, our code may, under special circumstances, silently break.
So this patch makes sure all sources of vtnrs verify the validity. Also
note that the dbus api already uses unsigned ints.
Diffstat (limited to 'src/login/logind-dbus.c')
-rw-r--r-- | src/login/logind-dbus.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index e0333cd6b0..4239b3788a 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -496,7 +496,7 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use if (v <= 0) return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Cannot determine VT number from virtual console TTY %s", tty); - if (vtnr <= 0) + if (!vtnr) vtnr = (uint32_t) v; else if (vtnr != (uint32_t) v) return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Specified TTY and VT number do not match"); |