summaryrefslogtreecommitdiff
path: root/src/login/loginctl.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-01-14 23:16:28 +0100
committerLennart Poettering <lennart@poettering.net>2015-01-14 23:18:33 +0100
commit2fbcde7402a26d365b6a8091b912154e6d187ee4 (patch)
tree4260a6f0d8bd5d034d19dfe9a747a155dec3cbd9 /src/login/loginctl.c
parentc7fbd99660363b74ccb3c75d280c158518bc78b3 (diff)
loginctl: fix misuse compound literals
The lifetime of compound literals is bound to the local scope, we hence cannot refernce them outside of it.
Diffstat (limited to 'src/login/loginctl.c')
-rw-r--r--src/login/loginctl.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index 064411ea8a..b0eede9a34 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -846,6 +846,7 @@ static int show_seat(int argc, char *argv[], void *userdata) {
static int activate(int argc, char *argv[], void *userdata) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
sd_bus *bus = userdata;
+ char *short_argv[3];
int r, i;
assert(bus);
@@ -858,7 +859,11 @@ static int activate(int argc, char *argv[], void *userdata) {
* session name, which the calls will then resolve to
* the caller's session. */
- argv = STRV_MAKE(argv[0], "");
+ short_argv[0] = argv[0];
+ short_argv[1] = (char*) "";
+ short_argv[2] = NULL;
+
+ argv = short_argv;
argc = 2;
}
@@ -919,6 +924,7 @@ static int kill_session(int argc, char *argv[], void *userdata) {
static int enable_linger(int argc, char *argv[], void *userdata) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
sd_bus *bus = userdata;
+ char* short_argv[3];
bool b;
int r, i;
@@ -930,7 +936,10 @@ static int enable_linger(int argc, char *argv[], void *userdata) {
b = streq(argv[0], "enable-linger");
if (argc < 2) {
- argv = STRV_MAKE(argv[0], "");
+ short_argv[0] = argv[0];
+ short_argv[1] = (char*) "";
+ short_argv[2] = NULL;
+ argv = short_argv;
argc = 2;
}