diff options
Diffstat (limited to 'x11vnc/x11vnc.c')
-rw-r--r-- | x11vnc/x11vnc.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c index 3f965e2..d427f32 100644 --- a/x11vnc/x11vnc.c +++ b/x11vnc/x11vnc.c @@ -1065,6 +1065,7 @@ static void check_rcfile(int argc, char **argv) { if (! home) { norc = 1; } else { + memset(rcfile, 0, sizeof(rcfile)); strncpy(rcfile, home, 500); free(home); @@ -1394,6 +1395,7 @@ static void quick_pw(char *str) { if(fgets(tmp, 1024, in) == NULL) { exit(2); } + fclose(in); q = strdup(tmp); } else { q = strdup(str+1); @@ -2574,6 +2576,10 @@ int main(int argc, char* argv[]) { grab_ptr = 1; continue; } + if (!strcmp(arg, "-ungrabboth")) { + ungrab_both = 1; + continue; + } if (!strcmp(arg, "-grabalways")) { grab_kbd = 1; grab_ptr = 1; @@ -4274,7 +4280,7 @@ int main(int argc, char* argv[]) { char *pstr = "%VNCDISPLAY"; if (strstr(logfile, pstr)) { char *h = this_host(); - char *s, *q, *new; + char *s, *q, *newlog; int n, p = got_rfbport_val; /* we don't really know the port yet... so guess */ if (p < 0) { @@ -4293,23 +4299,23 @@ int main(int argc, char* argv[]) { n++; q = t+1; } - new = (char *) malloc(strlen(logfile) + n * strlen(pstr)); - new[0] = '\0'; + newlog = (char *) malloc(strlen(logfile) + n * strlen(pstr)); + newlog[0] = '\0'; q = logfile; while (1) { char *t = strstr(q, pstr); if (!t) { - strcat(new, q); + strcat(newlog, q); break; } - strncat(new, q, t - q); - strcat(new, s); + strncat(newlog, q, t - q); + strcat(newlog, s); q = t + strlen(pstr); } - logfile = new; + logfile = newlog; if (!quiet && !got_inetd) { - rfbLog("Expanded logfile to '%s'\n", new); + rfbLog("Expanded logfile to '%s'\n", newlog); } free(s); @@ -4317,7 +4323,7 @@ int main(int argc, char* argv[]) { pstr = "%HOME"; if (strstr(logfile, pstr)) { char *h = get_home_dir(); - char *s, *q, *new; + char *s, *q, *newlog; s = (char *) malloc(strlen(h) + 32); sprintf(s, "%s", h); @@ -4329,23 +4335,23 @@ int main(int argc, char* argv[]) { n++; q = t+1; } - new = (char *) malloc(strlen(logfile) + n * strlen(pstr)); - new[0] = '\0'; + newlog = (char *) malloc(strlen(logfile) + n * strlen(pstr)); + newlog[0] = '\0'; q = logfile; while (1) { char *t = strstr(q, pstr); if (!t) { - strcat(new, q); + strcat(newlog, q); break; } - strncat(new, q, t - q); - strcat(new, s); + strncat(newlog, q, t - q); + strcat(newlog, s); q = t + strlen(pstr); } - logfile = new; + logfile = newlog; if (!quiet && !got_inetd) { - rfbLog("Expanded logfile to '%s'\n", new); + rfbLog("Expanded logfile to '%s'\n", newlog); } free(s); } |