files: block the resizing signal while reading from an external command
A SIGWINCH somehow causes the input stream to see EOT, with the result that any remaining output of an external program would be lost. This fixes https://savannah.gnu.org/bugs/?56038, and fixes https://savannah.gnu.org/bugs/?56033. Signed-off-by: Brand Huntsman <alpha@qzx.com>master
parent
8e302738e8
commit
32431cddf8
|
@ -800,6 +800,10 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
|
|||
topline = make_new_node(NULL);
|
||||
bottomline = topline;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
block_sigwinch(TRUE);
|
||||
#endif
|
||||
|
||||
/* Lock the file before starting to read it, to avoid the overhead
|
||||
* of locking it for each single byte that we read from it. */
|
||||
flockfile(f);
|
||||
|
@ -875,6 +879,10 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
|
|||
/* We are done with the file, unlock it. */
|
||||
funlockfile(f);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
block_sigwinch(FALSE);
|
||||
#endif
|
||||
|
||||
/* Perhaps this could use some better handling. */
|
||||
if (ferror(f))
|
||||
nperror(filename);
|
||||
|
|
|
@ -1290,7 +1290,7 @@ RETSIGTYPE do_continue(int signal)
|
|||
ungetch(KEY_FLUSH);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SPELLER
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_SPELLER)
|
||||
/* Block or unblock the SIGWINCH signal, depending on the blockit parameter. */
|
||||
void block_sigwinch(bool blockit)
|
||||
{
|
||||
|
@ -1299,6 +1299,11 @@ void block_sigwinch(bool blockit)
|
|||
sigemptyset(&winch);
|
||||
sigaddset(&winch, SIGWINCH);
|
||||
sigprocmask(blockit ? SIG_BLOCK : SIG_UNBLOCK, &winch, NULL);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (the_window_resized)
|
||||
regenerate_screen();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -424,7 +424,7 @@ RETSIGTYPE handle_crash(int signal);
|
|||
#endif
|
||||
RETSIGTYPE do_suspend(int signal);
|
||||
RETSIGTYPE do_continue(int signal);
|
||||
#ifdef ENABLE_SPELLER
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_SPELLER)
|
||||
void block_sigwinch(bool blockit);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
|
|
Loading…
Reference in New Issue