diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2019-07-16 05:04:37 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2019-07-16 05:04:37 -0400 |
commit | 7545239de1666f9d1c2027ded3b3af053c1eb6f5 (patch) | |
tree | fffb8bdff3ec627e3a6827199d93f12ef8380237 | |
parent | 87281920e1d15d4dc5c50f79750ab9ff173c0e8d (diff) |
fix const-warnings by making a copy of the data
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
-rw-r--r-- | src/session.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/session.c b/src/session.c index 1531626..a908efc 100644 --- a/src/session.c +++ b/src/session.c @@ -744,23 +744,23 @@ SaveYourselfPhase2CB (SmcConn smcConn2, SmPointer clientData _X_UNUSED) char userId[20]; char hint = SmRestartIfRunning; - prop1.name = SmProgram; - prop1.type = SmARRAY8; + prop1.name = strdup(SmProgram); + prop1.type = strdup(SmARRAY8); prop1.num_vals = 1; prop1.vals = &prop1val; prop1val.value = Argv[0]; prop1val.length = (int)strlen (Argv[0]); snprintf (userId, sizeof(userId), "%ld", (long)getuid()); - prop2.name = SmUserID; - prop2.type = SmARRAY8; + prop2.name = strdup(SmUserID); + prop2.type = strdup(SmARRAY8); prop2.num_vals = 1; prop2.vals = &prop2val; prop2val.value = (SmPointer) userId; prop2val.length = (int)strlen (userId); - prop3.name = SmRestartStyleHint; - prop3.type = SmCARD8; + prop3.name = strdup(SmRestartStyleHint); + prop3.type = strdup(SmCARD8); prop3.num_vals = 1; prop3.vals = &prop3val; prop3val.value = (SmPointer) &hint; @@ -828,8 +828,8 @@ SaveYourselfPhase2CB (SmcConn smcConn2, SmPointer clientData _X_UNUSED) } } - prop1.name = SmRestartCommand; - prop1.type = SmLISTofARRAY8; + prop1.name = strdup(SmRestartCommand); + prop1.type = strdup(SmLISTofARRAY8); prop1.vals = malloc ((size_t)(Argc + 4) * sizeof (SmPropValue)); @@ -855,23 +855,23 @@ SaveYourselfPhase2CB (SmcConn smcConn2, SmPointer clientData _X_UNUSED) } } - prop1.vals[numVals].value = (SmPointer) "-clientId"; + prop1.vals[numVals].value = strdup("-clientId"); prop1.vals[numVals++].length = 9; - prop1.vals[numVals].value = (SmPointer) twm_clientId; + prop1.vals[numVals].value = strdup(twm_clientId); prop1.vals[numVals++].length = (int)strlen (twm_clientId); - prop1.vals[numVals].value = (SmPointer) "-restore"; + prop1.vals[numVals].value = strdup("-restore"); prop1.vals[numVals++].length = 8; - prop1.vals[numVals].value = (SmPointer) filename; + prop1.vals[numVals].value = strdup(filename); prop1.vals[numVals++].length = (int)strlen (filename); prop1.num_vals = numVals; snprintf (discardCommand, sizeof(discardCommand), "rm %s", filename); - prop2.name = SmDiscardCommand; - prop2.type = SmARRAY8; + prop2.name = strdup(SmDiscardCommand); + prop2.type = strdup(SmARRAY8); prop2.num_vals = 1; prop2.vals = &prop2val; prop2val.value = (SmPointer) discardCommand; |