Also fix the reason argument to be const char * to clear several gcc warnings of: kdrive.c:151:2: warning: passing argument 1 of 'KdDoSwitchCmd' discards qualifiers from pointer target type kdrive.c:116:1: note: expected 'char *' but argument is of type 'const char *'
Signed-off-by: Alan Coopersmith <[email protected]> --- hw/kdrive/src/kdrive.c | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-) diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index 8dd039e..2c64940 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -113,19 +113,14 @@ KdDisableScreen (ScreenPtr pScreen) } static void -KdDoSwitchCmd (char *reason) +KdDoSwitchCmd (const char *reason) { if (kdSwitchCmd) { - char *command = malloc(strlen (kdSwitchCmd) + - 1 + - strlen (reason) + - 1); - if (!command) + char *command; + + if (asprintf(&command, "%s %s", kdSwitchCmd, reason) == -1) return; - strcpy (command, kdSwitchCmd); - strcat (command, " "); - strcat (command, reason); system (command); free(command); } -- 1.7.3.2 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
