2015-01-23 15:40:26 +01:00
|
|
|
--- src/gplt_x11.c.orig 2015-01-21 20:03:55.735504922 +0100
|
|
|
|
+++ src/gplt_x11.c 2015-01-21 20:04:14.327506641 +0100
|
|
|
|
@@ -951,6 +951,8 @@
|
2009-06-15 16:35:00 +02:00
|
|
|
nfds = cn + 1;
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
+ int ipc;
|
|
|
|
+
|
|
|
|
XFlush(dpy); /* see above */
|
|
|
|
|
|
|
|
FD_ZERO(&tset);
|
2015-01-23 15:40:26 +01:00
|
|
|
@@ -988,7 +990,11 @@
|
2009-06-15 16:35:00 +02:00
|
|
|
process_event(&xe);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
- if ((X11_ipc = fopen(X11_ipcpath, "r"))) {
|
|
|
|
+
|
|
|
|
+ if ((ipc = open(X11_ipcpath, O_RDONLY|O_CREAT|O_CLOEXEC|O_EXCL)) < 0)
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ if ((X11_ipc = dfopen(ipc, "r"))) {
|
|
|
|
unlink(X11_ipcpath);
|
|
|
|
record();
|
|
|
|
fclose(X11_ipc);
|
2015-01-23 15:40:26 +01:00
|
|
|
@@ -1216,8 +1222,8 @@
|
2009-06-15 16:35:00 +02:00
|
|
|
static int
|
|
|
|
read_input()
|
|
|
|
{
|
2010-04-07 21:19:15 +02:00
|
|
|
- static int rdbuf_size = 10 * X11_COMMAND_BUFFER_LENGTH;
|
|
|
|
- static char rdbuf[10 * X11_COMMAND_BUFFER_LENGTH];
|
|
|
|
+ const int rdbuf_size = 10 * X11_COMMAND_BUFFER_LENGTH;
|
|
|
|
+ static char rdbuf[(10 * X11_COMMAND_BUFFER_LENGTH)+1];
|
2009-06-15 16:35:00 +02:00
|
|
|
static int total_chars;
|
|
|
|
static int rdbuf_offset;
|
|
|
|
static int buf_offset;
|