aboutsummaryrefslogtreecommitdiffstats
path: root/vncviewer
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2014-07-09 17:02:27 +0200
committerPierre Ossman <ossman@cendio.se>2014-07-14 16:03:42 +0200
commitf8d525b1290641917bbb379325a9694803436c4a (patch)
tree4512c291db66a801254c4e7db77cf42c3847edb1 /vncviewer
parentc0397269fcab67e9acd4fdcbc29f24d79ed0ef39 (diff)
downloadtigervnc-f8d525b1290641917bbb379325a9694803436c4a.tar.gz
tigervnc-f8d525b1290641917bbb379325a9694803436c4a.zip
String literals are constant
Diffstat (limited to 'vncviewer')
-rw-r--r--vncviewer/vncviewer.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx
index eaf94ba6..3f039379 100644
--- a/vncviewer/vncviewer.cxx
+++ b/vncviewer/vncviewer.cxx
@@ -313,8 +313,8 @@ static void
createTunnel(const char *gatewayHost, const char *remoteHost,
int remotePort, int localPort)
{
- char *cmd = getenv("VNC_VIA_CMD");
- char *percent;
+ const char *cmd = getenv("VNC_VIA_CMD");
+ char *cmd2, *percent;
char lport[10], rport[10];
sprintf(lport, "%d", localPort);
sprintf(rport, "%d", remotePort);
@@ -325,9 +325,11 @@ createTunnel(const char *gatewayHost, const char *remoteHost,
if (!cmd)
cmd = "/usr/bin/ssh -f -L \"$L\":\"$H\":\"$R\" \"$G\" sleep 20";
/* Compatibility with TigerVNC's method. */
- while ((percent = strchr(cmd, '%')) != NULL)
+ cmd2 = strdup(cmd);
+ while ((percent = strchr(cmd2, '%')) != NULL)
*percent = '$';
- system(cmd);
+ system(cmd2);
+ free(cmd2);
}
static int mktunnel()