https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=3815e9939b2f5f9c5448c13225ca86154d948744

commit 3815e9939b2f5f9c5448c13225ca86154d948744
Author: Christian Franke <christian.fra...@t-online.de>
Date:   Sat Apr 12 15:51:53 2025 +0200

    Cygwin: kill(1): fix parsing of negative pid
    
    Signed-off-by: Christian Franke <christian.fra...@t-online.de>

Diff:
---
 winsup/utils/kill.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/winsup/utils/kill.cc b/winsup/utils/kill.cc
index bcabcd47c..1e6ab5c4b 100644
--- a/winsup/utils/kill.cc
+++ b/winsup/utils/kill.cc
@@ -372,7 +372,9 @@ main (int argc, char **argv)
        case '?':
          if (gotasig) /* this is a negative pid, go ahead */
            {
-             --optind;
+             /* Reset optind because it points to the next argument if and
+                only if the pid has one digit. */
+             optind = av - argv;
              goto out;
            }
          optreset = 1;

Reply via email to