OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: ftp abort diff

From: Nickolay A. Burkov (nbrklinklevel.net)
Date: Sun Feb 01 2009 - 05:55:22 CST


Very cool.
Before this diff I was used to hit ctrl-\ after few "unsuccessfull"
ctrl-c's. That was very annoying.
Now I only need to press ctrl-c twice.

Thanks! Please commit it.

On Sat, Jan 31, 2009 at 02:12:47AM +0100, Alexander Hall wrote:
> Lo and behold this mighty diff that lets you ^C your way out of an
> aborted file retrieval from a misbehaving ftp server.
>
> It simply sets the default SIGINT action while waiting for the remote
> to abort (or be done with it). This means you can still press ^C _once_
> to perform a well-behaved abort.
>
> While testing against a misbehaving host and aborting "nicely" (pressing
> ^C once), it still hung after the remote was finished sending the file
> but that issue was not introduced by this trivial diff.
>
> /Alexander
>
> Index: ftp.c
> ===================================================================
> RCS file: /store/openbsd/cvs/src/usr.bin/ftp/ftp.c,v
> retrieving revision 1.73
> diff -u -p -r1.73 ftp.c
> --- ftp.c 8 Jul 2008 21:07:57 -0000 1.73
> +++ ftp.c 31 Jan 2009 00:49:18 -0000
> -1199,7 +1199,7 abort:
> preserve = opreserve;
> if (oldintp)
> (void)signal(SIGPIPE, oldintp);
> - (void)signal(SIGINT, SIG_IGN);
> + (void)signal(SIGINT, SIG_DFL);
> if (!cpend) {
> code = -1;
> (void)signal(SIGINT, oldintr);
>

--
C programmers never die. They're just cast into void.

() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments