Bug#2089: lrzsz hangs
Package: lrzsz
Version: 0.11
If the connection closes while lrz is downloading a file, lrz will hang.
This happens because the maintainer of the package commented out all of the
calls to signal(). I fixed the declarations of the signal handlers instead.
I'll append my patches. Thanks in advance for integrating them. I would
offer to take over the package, but I don't really use it and don't have
time to read the source code of dpkg/dselect. (Is there any documentation
yet?)
Matt Birkholz <birkholz@midnight.com.>
Finger birkholz@primenet.com for PGP 2.6.2 Public Key ID = 74305425
Key Fingerprint = B3 34 FB 3E 3C FE E8 57 AA B4 B2 95 A7 C0 1E AF
*** lrz.c.~1~ Sun Jul 17 08:29:48 1994
--- lrz.c Sat Dec 9 00:36:51 1995
***************
*** 131,143 ****
#include "zm.c"
int tryzhdrtype=ZRINIT; /* Header type to send corresponding to Last rx close */
!
! alrm()
{
! longjmp(tohere, -1);
}
/* called by signal interrupt or terminate to clean things up */
bibi(n)
{
if (Zmodem)
--- 131,148 ----
#include "zm.c"
int tryzhdrtype=ZRINIT; /* Header type to send corresponding to Last rx close */
! #ifdef LINUX
! void
! #endif
! alrm(int signum)
{
! longjmp(tohere, signum);
}
/* called by signal interrupt or terminate to clean things up */
+ #ifdef LINUX
+ void
+ #endif
bibi(n)
{
if (Zmodem)
***************
*** 240,246 ****
}
vfile("%s %s for %s\n", Progname, VERSION, OS);
mode(1);
! #ifndef LINUX
if (signal(SIGINT, bibi) == SIG_IGN) {
signal(SIGINT, SIG_IGN); signal(SIGKILL, SIG_IGN);
}
--- 245,251 ----
}
vfile("%s %s for %s\n", Progname, VERSION, OS);
mode(1);
!
if (signal(SIGINT, bibi) == SIG_IGN) {
signal(SIGINT, SIG_IGN); signal(SIGKILL, SIG_IGN);
}
***************
*** 248,254 ****
signal(SIGINT, bibi); signal(SIGKILL, bibi);
}
signal(SIGTERM, bibi);
! #endif
if (wcreceive(npats, patts)==ERROR) {
exitcode=0200;
canit();
--- 253,259 ----
signal(SIGINT, bibi); signal(SIGKILL, bibi);
}
signal(SIGTERM, bibi);
!
if (wcreceive(npats, patts)==ERROR) {
exitcode=0200;
canit();
***************
*** 574,582 ****
fprintf(stderr, "Readline:TIMEOUT\n");
return TIMEOUT;
}
! #ifndef LINUX
signal(SIGALRM, alrm); alarm(n);
! #endif
Lleft=read(iofd, cdq=linbuf, Readnum);
alarm(0);
if (Verbose > 5) {
--- 579,587 ----
fprintf(stderr, "Readline:TIMEOUT\n");
return TIMEOUT;
}
!
signal(SIGALRM, alrm); alarm(n);
!
Lleft=read(iofd, cdq=linbuf, Readnum);
alarm(0);
if (Verbose > 5) {
*** lsz.c.~1~ Sun Jul 17 08:29:57 1994
--- lsz.c Sat Dec 9 00:46:35 1995
***************
*** 145,150 ****
--- 145,153 ----
jmp_buf intrjmp; /* For the interrupt on RX CAN */
/* called by signal interrupt or terminate to clean things up */
+ #ifdef LINUX
+ void
+ #endif
bibi(n)
{
canit(); fflush(stdout); mode(0);
***************
*** 157,165 ****
exit(128+n);
}
/* Called when ZMODEM gets an interrupt (^X) */
! onintr()
{
! signal(SIGINT, SIG_IGN);
longjmp(intrjmp, -1);
}
--- 160,171 ----
exit(128+n);
}
/* Called when ZMODEM gets an interrupt (^X) */
! #ifdef LINUX
! void
! #endif
! onintr(int signum)
{
! signal(signum, SIG_IGN);
longjmp(intrjmp, -1);
}
***************
*** 333,339 ****
mode(1);
- #ifndef LINUX
if (signal(SIGINT, bibi) == SIG_IGN) {
signal(SIGINT, SIG_IGN); signal(SIGKILL, SIG_IGN);
} else {
--- 339,344 ----
***************
*** 342,348 ****
if ( !Fromcu)
signal(SIGQUIT, SIG_IGN);
signal(SIGTERM, bibi);
- #endif
if ( !Modem2) {
if (!Nozmodem) {
--- 347,352 ----
***************
*** 840,849 ****
}
}
!
! alrm()
{
! longjmp(tohere, -1);
}
--- 844,855 ----
}
}
! #ifdef LINUX
! void
! #endif
! alrm(int signum)
{
! longjmp(tohere, signum);
}
***************
*** 867,875 ****
if (Verbose>5) {
fprintf(stderr, "Timeout=%d Calling alarm(%d) ", timeout, c);
}
! #ifndef LINUX
signal(SIGALRM, alrm); alarm(c);
! #endif
c=read(iofd, byt, 1);
alarm(0);
if (Verbose>5)
--- 873,881 ----
if (Verbose>5) {
fprintf(stderr, "Timeout=%d Calling alarm(%d) ", timeout, c);
}
!
signal(SIGALRM, alrm); alarm(c);
!
c=read(iofd, byt, 1);
alarm(0);
if (Verbose>5)
***************
*** 1236,1254 ****
c = getinsync(1);
goto gotack;
case XOFF: /* Wait a while for an XON */
- #ifndef LINUX
case XOFF|0200:
- #endif
readline(100);
}
}
#endif
}
- #ifndef LINUX
if ( !Fromcu)
signal(SIGINT, onintr);
- #endif
newcnt = Rxbuflen;
Txwcnt = 0;
--- 1242,1256 ----
***************
*** 1280,1288 ****
#endif
goto waitack;
case XOFF: /* Wait for XON */
- #ifndef LINUX
case XOFF|0200:
- #endif
readline(100);
}
}
--- 1282,1288 ----
***************
*** 1346,1354 ****
zsdata(txbuf, 0, ZCRCE);
goto gotack;
case XOFF: /* Wait a while for an XON */
- #ifndef LINUX
case XOFF|0200:
- #endif
readline(100);
default:
++junkcount;
--- 1346,1352 ----
Reply to: