public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: utils: kill: revert erroneously removed optind correction
Date: Mon, 18 Feb 2019 09:56:00 -0000	[thread overview]
Message-ID: <20190218095622.9787.qmail@sourceware.org> (raw)

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

commit 5e6ce1cfb212a6dd71790933186275081cffe3c3
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Sun Feb 17 22:59:36 2019 +0100

    Cygwin: utils: kill: revert erroneously removed optind correction
    
    When recognizing a negative pid, optind is off by one.  The
    code correcting this has been erroneously removed by commit
    8de660271fe75a6993f1c9888d24b824bb7f999d.  Revert that.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/release/3.0.1 | 3 +++
 winsup/utils/kill.cc        | 5 ++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/release/3.0.1 b/winsup/cygwin/release/3.0.1
index ae6e03e..fd6595b 100644
--- a/winsup/cygwin/release/3.0.1
+++ b/winsup/cygwin/release/3.0.1
@@ -11,3 +11,6 @@ Bug Fixes
 
 - Relax fork child permissions to avoid a potential fork failure.
   Addresses: https://cygwin.com/ml/cygwin/2019-02/msg00234.html
+
+- Fix Command-line argument handling of kill(1) in terms of negative PID.
+  Addresses: report on IRC
diff --git a/winsup/utils/kill.cc b/winsup/utils/kill.cc
index 768ac44..a22d702 100644
--- a/winsup/utils/kill.cc
+++ b/winsup/utils/kill.cc
@@ -251,7 +251,10 @@ main (int argc, char **argv)
 	  break;
 	case '?':
 	  if (gotasig) /* this is a negative pid, go ahead */
-	    goto out;
+	    {
+	      --optind;
+	      goto out;
+	    }
 	  optreset = 1;
 	  optind = 1 + av - argv;
 	  gotasig = *av + 1;


                 reply	other threads:[~2019-02-18  9:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190218095622.9787.qmail@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).