File fix4bug1240330.patch of Package gnuplot.38683
commit af96c2c1b20383684b1ec2084dab7936f7053031
Author: Ethan A Merritt <merritt@u.washington.edu>
Date: Tue Jan 14 20:56:37 2025 -0800
x11: protect against double fclose() if two errors in a row
Bug 2753
---
term/x11.trm | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--- term/x11.trm
+++ term/x11.trm 2025-05-13 10:53:54.326956253 +0000
@@ -856,8 +856,9 @@ X11_atexit()
/* dont wait(), since they might be -persist */
X11_ipc = NULL;
#ifdef PIPE_IPC
- close(ipc_back_fd);
- ipc_back_fd = -1;
+ if (ipc_back_fd >= 0)
+ close(ipc_back_fd);
+ ipc_back_fd = IPC_BACK_CLOSED;
#endif
}
}
@@ -1412,7 +1413,8 @@ X11_graphics()
#ifdef PIPE_IPC
/* if we know the outboard driver has stopped, restart it */
if (ipc_back_fd == IPC_BACK_CLOSED) {
- fclose(X11_ipc);
+ if (X11_ipc > 0)
+ fclose(X11_ipc);
X11_ipc = NULL;
X11_init();
}