summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-07 16:42:36 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-07 16:53:25 +0100
commit29d230f6f297e76ea06eb1365f6f6c16a92abf9e (patch)
treee412f173b70866ca87368c3731dc00ec3ff85833
parent49a6199b42b34ac16b03af9eec9b4ee7a31aa9f4 (diff)
pam: the DECIMAL_STR_MAX macro is awesome, let's use it
-rw-r--r--src/login/pam-module.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/login/pam-module.c b/src/login/pam-module.c
index 58f974241b..f469244118 100644
--- a/src/login/pam-module.c
+++ b/src/login/pam-module.c
@@ -403,9 +403,8 @@ _public_ PAM_EXTERN int pam_sm_open_session(
}
if (vtnr > 0) {
- char buf[11];
+ char buf[DECIMAL_STR_MAX(vtnr)];
snprintf(buf, sizeof(buf), "%u", vtnr);
- char_array_0(buf);
r = pam_misc_setenv(handle, "XDG_VTNR", buf, 0);
if (r != PAM_SUCCESS) {
@@ -443,14 +442,13 @@ _public_ PAM_EXTERN int pam_sm_close_session(
int flags,
int argc, const char **argv) {
+ _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
+ _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
+ _cleanup_bus_unref_ sd_bus *bus = NULL;
const void *p = NULL, *existing = NULL;
const char *id;
int r;
- _cleanup_bus_unref_ sd_bus *bus = NULL;
- _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
- _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
-
assert(handle);
/* Only release session if it wasn't pre-existing when we