=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ftp/ftp.c,v retrieving revision 1.78 retrieving revision 1.79 diff -c -r1.78 -r1.79 *** src/usr.bin/ftp/ftp.c 2009/04/27 23:20:48 1.78 --- src/usr.bin/ftp/ftp.c 2009/06/06 23:14:44 1.79 *************** *** 1,4 **** ! /* $OpenBSD: ftp.c,v 1.78 2009/04/27 23:20:48 martynas Exp $ */ /* $NetBSD: ftp.c,v 1.27 1997/08/18 10:20:23 lukem Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: ftp.c,v 1.79 2009/06/06 23:14:44 martynas Exp $ */ /* $NetBSD: ftp.c,v 1.27 1997/08/18 10:20:23 lukem Exp $ */ /* *************** *** 1196,1204 **** return; abort: ! ! /* abort using RFC959 recommended IP,SYNC sequence */ ! progress = oprogress; preserve = opreserve; if (oldintp) --- 1196,1202 ---- return; abort: ! /* abort using RFC959 recommended IP,SYNC sequence */ progress = oprogress; preserve = opreserve; if (oldintp) *************** *** 1974,1987 **** return (new); } void abort_remote(FILE *din) { char buf[BUFSIZ]; int nfnd; struct pollfd pfd[2]; ! if (cout == NULL) { warnx("Lost control connection for abort."); if (ptabflg) code = -1; --- 1972,2003 ---- return (new); } + jmp_buf forceabort; + + /* ARGSUSED */ void + abortforce(int signo) + { + fputs("Forced abort. The connection will be closed.\n", ttyout); + (void)fflush(ttyout); + + if (cout) { + (void)fclose(cout); + } + cout = NULL; + + longjmp(forceabort, 1); + } + + void abort_remote(FILE *din) { char buf[BUFSIZ]; int nfnd; struct pollfd pfd[2]; + sig_t oldintr; ! if (cout == NULL || setjmp(forceabort)) { warnx("Lost control connection for abort."); if (ptabflg) code = -1; *************** *** 1989,1994 **** --- 2005,2012 ---- return; } + oldintr = signal(SIGINT, abortforce); + /* * send IAC in urgent mode instead of DM because 4.3BSD places oob mark * after urgent byte rather than before as is protocol now *************** *** 2022,2025 **** --- 2040,2044 ---- (void)getreply(0); } (void)getreply(0); + (void)signal(SIGINT, oldintr); }