summaryrefslogtreecommitdiffstats
path: root/x11vnc/gui.c
diff options
context:
space:
mode:
authorrunge <runge>2008-09-14 19:28:25 +0000
committerrunge <runge>2008-09-14 19:28:25 +0000
commit95d7788eb062a6c6ba07bee516e4e8f1cc8a4db4 (patch)
tree37da2bfec58413d02c9fbe59f86e848bf0fec348 /x11vnc/gui.c
parentd5cba7a574a667f5321194cb05d0b4adcb995866 (diff)
downloadlibtdevnc-95d7788eb062a6c6ba07bee516e4e8f1cc8a4db4.tar.gz
libtdevnc-95d7788eb062a6c6ba07bee516e4e8f1cc8a4db4.zip
x11vnc: -sleepin m-n for random sleep. More mktemp and mkstemp
protections. SSL_INIT_TIMEOUT=n env. var. Fix macosx console X call bug. Synchronize other projects sources.
Diffstat (limited to 'x11vnc/gui.c')
-rw-r--r--x11vnc/gui.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/x11vnc/gui.c b/x11vnc/gui.c
index 541af1f..940a069 100644
--- a/x11vnc/gui.c
+++ b/x11vnc/gui.c
@@ -667,24 +667,22 @@ void do_gui(char *opts, int sleep) {
pid_t parent = getpid();
if (icon_mode) {
- char tf[100];
- double dn = dnow();
+ char tf[] = "/tmp/x11vnc.tray.XXXXXX";
+ int fd;
struct stat sbuf;
- /* FIXME */
- dn = dn - ((int) dn);
- sprintf(tf, "/tmp/x11vnc.tray%d%d", (int) (1000000*dn),
- (int) getpid());
- unlink(tf);
- /* race begins.. */
- if (stat(tf, &sbuf) == 0) {
+
+ fd = mkstemp(tf);
+ if (fd < 0) {
icon_mode = 0;
} else {
+ close(fd);
icon_mode_fh = fopen(tf, "w");
if (! icon_mode_fh) {
icon_mode = 0;
} else {
chmod(tf, 0400);
icon_mode_file = strdup(tf);
+ rfbLog("icon_mode_file=%s\n", icon_mode_file);
fprintf(icon_mode_fh, "none\n");
fprintf(icon_mode_fh, "none\n");
fflush(icon_mode_fh);