diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2018-01-03 01:55:32 +0100 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2018-01-07 01:27:07 +0100 |
commit | a0e985fb6d28c1ef551823e3b2a013b29192ac02 (patch) | |
tree | 0d9b5469932c6316caa450f2ed88162fa48dbb5e /nx-X11/programs/Xserver/hw/nxagent/Keystroke.c | |
parent | 1854700722db8067460e82a711521fdb27fb51d4 (diff) | |
download | nx-libs-a0e985fb6d28c1ef551823e3b2a013b29192ac02.tar.gz nx-libs-a0e985fb6d28c1ef551823e3b2a013b29192ac02.tar.bz2 nx-libs-a0e985fb6d28c1ef551823e3b2a013b29192ac02.zip |
Keystroke.c: replace calloc + 2 * strcpy by asprintf
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Keystroke.c')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Keystroke.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c index f790090bf..61b4512fb 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c @@ -324,13 +324,11 @@ void nxagentInitKeystrokes(Bool force) char *homedir = getenv("HOME"); if (homedir) { - if (!(homepath = calloc(1, strlen(homedir) + strlen(homefile) + 1))) + if (-1 == asprintf(&homepath, "%s%s", homedir, homefile)) { fprintf(stderr, "malloc failed"); exit(EXIT_FAILURE); } - strcpy(homepath, homedir); - strcpy(homepath + strlen(homedir), homefile); } /* if any of the files can be read we have our candidate */ |