[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, test-socket-patch, created. gawk-4.1.0-4274-gc48697e
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, test-socket-patch, created. gawk-4.1.0-4274-gc48697e |
Date: |
Mon, 26 Jul 2021 07:16:21 -0400 (EDT) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, test-socket-patch has been created
at c48697ed182ae014a3f0dc734e362270bba898bf (commit)
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=c48697ed182ae014a3f0dc734e362270bba898bf
commit c48697ed182ae014a3f0dc734e362270bba898bf
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Mon Jul 26 05:15:38 2021 -0600
Test patch added.
diff --git a/awk.h b/awk.h
index cb7c499..4998694 100644
--- a/awk.h
+++ b/awk.h
@@ -960,6 +960,7 @@ typedef struct iobuf {
IOP_AT_EOF = 2,
IOP_CLOSED = 4,
IOP_AT_START = 8,
+ IOP_IS_SOCK = 16,
} flag;
} IOBUF;
@@ -1601,6 +1602,7 @@ extern void os_arg_fixup(int *argcp, char ***argvp);
extern int os_devopen(const char *name, int flag);
extern void os_close_on_exec(int fd, const char *name, const char *what, const
char *dir);
extern int os_isatty(int fd);
+extern int os_issock(int fd);
extern int os_isdir(int fd);
extern int os_isreadable(const awk_input_buf_t *iobuf, bool *isdir);
extern int os_is_setuid(void);
diff --git a/io.c b/io.c
index 91c94d9..fd62f87 100644
--- a/io.c
+++ b/io.c
@@ -3466,6 +3466,8 @@ iop_finish(IOBUF *iop)
if (os_isatty(iop->public.fd))
iop->flag |= IOP_IS_TTY;
+ else if (os_issock(iop->public.fd))
+ iop->flag |= IOP_IS_SOCK;
iop->readsize = iop->size = optimal_bufsize(iop->public.fd, &
iop->public.sbuf);
if (do_lint && S_ISREG(iop->public.sbuf.st_mode) &&
iop->public.sbuf.st_size == 0)
@@ -3759,7 +3761,7 @@ again:
*/
/* succession of tests is easier to trace in GDB. */
- if (RSre->maybe_long) {
+ if (RSre->maybe_long && (iop->flag & (IOP_IS_TTY|IOP_IS_SOCK)) == 0) {
char *matchend = iop->off + reend;
if (iop->dataend - matchend < RS->stlen)
diff --git a/posix/gawkmisc.c b/posix/gawkmisc.c
index d2e33f4..92124be 100644
--- a/posix/gawkmisc.c
+++ b/posix/gawkmisc.c
@@ -273,6 +273,16 @@ os_isatty(int fd)
return isatty(fd);
}
+/* os_issock --- return true if fd is a socket */
+
+int
+os_issock(int fd)
+{
+ struct stat sbuf;
+
+ return (fstat(fd, & sbuf) >= 0 && S_ISSOCK(sbuf.st_mode));
+}
+
/* files_are_same --- return true if files are identical */
int
-----------------------------------------------------------------------
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, test-socket-patch, created. gawk-4.1.0-4274-gc48697e,
Arnold Robbins <=