gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, select, updated. gawk-4.1.0-60-ga0d911d


From: Andrew J. Schorr
Subject: [gawk-diffs] [SCM] gawk branch, select, updated. gawk-4.1.0-60-ga0d911d
Date: Tue, 02 Jul 2013 18:24:36 +0000

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, select has been updated
       via  a0d911d5920362982fb6a5c1fa6047c69dc26668 (commit)
      from  c5d29ade6407adcec3eeef9e61a1474501acc0d3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=a0d911d5920362982fb6a5c1fa6047c69dc26668

commit a0d911d5920362982fb6a5c1fa6047c69dc26668
Author: Andrew J. Schorr <address@hidden>
Date:   Tue Jul 2 14:24:13 2013 -0400

    Tighten up some argument checks in the select extension.

diff --git a/extension/ChangeLog b/extension/ChangeLog
index 006ea8e..6778e2e 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,5 +1,10 @@
 2013-07-02         Andrew J. Schorr     <address@hidden>
 
+       * select.c (do_select): Do not treat a numeric command value as a
+       file descriptor unless the command type is empty.
+
+2013-07-02         Andrew J. Schorr     <address@hidden>
+
        * Makefile.am (EXTRA_DIST): Add errlist.h and siglist.h.
 
 2013-07-02         Andrew J. Schorr     <address@hidden>
diff --git a/extension/select.c b/extension/select.c
index c1b706f..be17dcf 100644
--- a/extension/select.c
+++ b/extension/select.c
@@ -241,18 +241,22 @@ do_select(int nargs, awk_value_t *result)
                                fds[i].array2fd[j] = -1;
                                switch (EL.index.val_type) {
                                case AWK_NUMBER:
-                                       if (EL.index.num_value >= 0)
-                                               fds[i].array2fd[j] = 
EL.index.num_value;
-                                       if (fds[i].array2fd[j] != 
EL.index.num_value) {
-                                               fds[i].array2fd[j] = -1;
-                                               warning(ext_id, _("select: 
invalid numeric index `%g' in `%s' array (should be a non-negative integer)"), 
EL.index.num_value, argname[i]);
+                                       if ((EL.value.val_type == 
AWK_UNDEFINED) || ((EL.value.val_type == AWK_STRING) && ! 
EL.value.str_value.len)) {
+                                               if (EL.index.num_value >= 0)
+                                                       fds[i].array2fd[j] = 
EL.index.num_value;
+                                               if (fds[i].array2fd[j] != 
EL.index.num_value) {
+                                                       fds[i].array2fd[j] = -1;
+                                                       warning(ext_id, 
_("select: invalid numeric index `%g' in `%s' array (should be a non-negative 
integer)"), EL.index.num_value, argname[i]);
+                                               }
                                        }
+                                       else
+                                               warning(ext_id, _("select: 
numeric index `%g' in `%s' array should have an empty command type to be 
treated as a file descriptor"), EL.index.num_value, argname[i]);
                                        break;
                                case AWK_STRING:
                                        {
                                                long x;
 
-                                               if 
((integer_string(EL.index.str_value.str, &x) == 0) && (x >= 0))
+                                               if 
((integer_string(EL.index.str_value.str, &x) == 0) && (x >= 0) && 
((EL.value.val_type == AWK_UNDEFINED) || ((EL.value.val_type == AWK_STRING) && 
! EL.value.str_value.len)))
                                                        fds[i].array2fd[j] = x;
                                                else if (EL.value.val_type == 
AWK_STRING) {
                                                        const awk_input_buf_t 
*buf;

-----------------------------------------------------------------------

Summary of changes:
 extension/ChangeLog |    5 +++++
 extension/select.c  |   16 ++++++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]