From: Warren Young <wyml@etr-usa.com>
To: The Cygwin Mailing List <cygwin@cygwin.com>
Subject: Re: ctrl-c doesn't reliably kill ping
Date: Wed, 16 Mar 2016 16:50:00 -0000 [thread overview]
Message-ID: <8D39BB0F-A716-4F56-AF2D-D6C928266F5A@etr-usa.com> (raw)
In-Reply-To: <CAD8GWstL-rUm9=q8tpReiiHm8Tmm94Caq7jQyszZ02Tw=EN_TQ@mail.gmail.com>
On Mar 16, 2016, at 10:07 AM, Lee <ler762@gmail.com> wrote:
>
> The last time I tried the cygwin ping program it didn't return a
> failure status
It does if you don’t Ctrl-C out of it. So, if you’re using it from a script, you just ask for one packet:
# ping does.not.exist 1 1
ping: unknown host does.not.exist
# echo $?
1
Note my fine new # prompt, indicating an admin shell, which has been required for Cygwin ping from the very beginning[1] due to the restrictions on raw sockets added in Windows XP SP2. Windows ping gets around this by special dispensation of the kernel.[2]
If you want to say Cygwin ping is “useless” because of that, blame Microsoft for not allowing ICMP raw sockets for normal users [3] or for not reinventing suid bits correctly. (UAC = not correct.)
Older Linuxes and some modern Unixes set the suid bit on the ping program to get around this, and newer Linuxes use getcap/setcap to give the ping program the right to use raw sockets so they don’t need u+s.[4]
[1] https://cygwin.com/ml/cygwin-apps/2005-01/msg00124.html
[2] It loads IPHLPAPI.DLL at run time in order to call IcmpSendEcho()
[3] https://goo.gl/o25d6U
[4] http://linux.die.net/man/8/setcap
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
next prev parent reply other threads:[~2016-03-16 16:50 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-14 17:18 ctrl-c doesn't reliably kill applications Björn Stabel
2016-03-14 23:39 ` Kaz Kylheku
2016-03-15 0:46 ` ctrl-c doesn't reliably kill ping Frank Farance
2016-03-15 11:05 ` Andrey Repin
2016-03-15 11:43 ` Adam Dinwoodie
2016-03-16 14:46 ` cyg Simple
2016-03-16 4:56 ` Kaz Kylheku
2016-03-16 11:50 ` Andrey Repin
2016-03-16 14:51 ` cyg Simple
2016-03-16 15:57 ` Michael Enright
2016-03-16 17:33 ` Kaz Kylheku
2016-03-16 18:10 ` Lee
2016-03-17 21:10 ` Frank Farance
2016-03-17 21:29 ` Marco Atzeri
2016-03-15 15:13 ` Warren Young
2016-03-16 13:25 ` Marco Atzeri
2016-03-17 20:04 ` ctrl-c doesn't reliably kill applications Björn Stabel
2016-04-18 21:38 ` Aaron Digulla
2016-04-19 9:13 ` Corinna Vinschen
2016-04-19 16:30 ` Aaron Digulla
2016-03-16 16:07 ` ctrl-c doesn't reliably kill ping Lee
2016-03-16 16:50 ` Warren Young [this message]
2016-03-16 17:52 ` Lee
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=8D39BB0F-A716-4F56-AF2D-D6C928266F5A@etr-usa.com \
--to=wyml@etr-usa.com \
--cc=cygwin@cygwin.com \
/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).