forked from pool/gnuplot
40 lines
1018 B
Plaintext
40 lines
1018 B
Plaintext
---
|
|
src/gplt_x11.c | 12 +++++++++---
|
|
1 file changed, 9 insertions(+), 3 deletions(-)
|
|
|
|
--- src/gplt_x11.c
|
|
+++ src/gplt_x11.c 2018-05-07 07:13:13.080045710 +0000
|
|
@@ -956,6 +956,8 @@ mainloop()
|
|
nfds = cn + 1;
|
|
|
|
while (1) {
|
|
+ int ipc;
|
|
+
|
|
XFlush(dpy); /* see above */
|
|
|
|
FD_ZERO(&tset);
|
|
@@ -993,7 +995,11 @@ mainloop()
|
|
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);
|
|
@@ -1225,8 +1231,8 @@ static int read_input __PROTO((void));
|
|
static int
|
|
read_input()
|
|
{
|
|
- 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];
|
|
static int total_chars;
|
|
static int rdbuf_offset;
|
|
static int buf_offset;
|