[X2Go-Commits] [nx-libs] 24/29: Keystroke.c: replace calloc + 2 * strcpy by asprintf

git-admin at x2go.org git-admin at x2go.org
Sun Jan 7 01:31:00 CET 2018


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch 3.6.x
in repository nx-libs.

commit a0e985fb6d28c1ef551823e3b2a013b29192ac02
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Wed Jan 3 01:55:32 2018 +0100

    Keystroke.c: replace calloc + 2 * strcpy by asprintf
---
 nx-X11/programs/Xserver/hw/nxagent/Keystroke.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
index f790090..61b4512 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 */

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list