--- freem/src/service.c 2025/04/09 19:52:02 1.13
+++ freem/src/service.c 2026/01/07 19:51:33 1.14
@@ -1,5 +1,5 @@
/*
- * $Id: service.c,v 1.13 2025/04/09 19:52:02 snw Exp $
+ * $Id: service.c,v 1.14 2026/01/07 19:51:33 snw Exp $
* terminal and sequential I/O handling,
* file and global locking
*
@@ -25,6 +25,9 @@
* along with FreeM. If not, see .
*
* $Log: service.c,v $
+ * Revision 1.14 2026/01/07 19:51:33 snw
+ * Fix segfault in reverse $QUERY
+ *
* Revision 1.13 2025/04/09 19:52:02 snw
* Eliminate as many warnings as possible while building with -Wall
*
@@ -68,6 +71,7 @@
#define MAXZAS NESTLEVLS
#include "mpsdef.h"
+#include "shmmgr.h"
#include
@@ -94,10 +98,9 @@ int scosgr (short att, short bwflag);
# endif
# define termio termios
# else
-# if !defined(MSDOS)
+# if !defined(MSDOS) && !defined(__linux__)
# include
-# endif
-# if defined(__OS2__)
+# else
# include
# define termio termios
# endif
@@ -106,6 +109,7 @@ int scosgr (short att, short bwflag);
# include
#endif
+
#include
/* search 'string' for occurence of 'pattrn'
@@ -4341,6 +4345,11 @@ int locking (int fd, int action, long co
struct flock lock;
+ /* skip locking if we own the TP semaphore */
+ if (shm_config->hdr->tp_owner == pid) {
+ return 0;
+ }
+
lock.l_whence = 1; /* lock from current position */
lock.l_start = 0;
lock.l_len = count;