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);
|
topline = make_new_node(NULL);
|
||||||
bottomline = topline;
|
bottomline = topline;
|
||||||
|
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
block_sigwinch(TRUE);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Lock the file before starting to read it, to avoid the overhead
|
/* Lock the file before starting to read it, to avoid the overhead
|
||||||
* of locking it for each single byte that we read from it. */
|
* of locking it for each single byte that we read from it. */
|
||||||
flockfile(f);
|
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. */
|
/* We are done with the file, unlock it. */
|
||||||
funlockfile(f);
|
funlockfile(f);
|
||||||
|
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
block_sigwinch(FALSE);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Perhaps this could use some better handling. */
|
/* Perhaps this could use some better handling. */
|
||||||
if (ferror(f))
|
if (ferror(f))
|
||||||
nperror(filename);
|
nperror(filename);
|
||||||
|
|
|
@ -1290,7 +1290,7 @@ RETSIGTYPE do_continue(int signal)
|
||||||
ungetch(KEY_FLUSH);
|
ungetch(KEY_FLUSH);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_SPELLER
|
#if !defined(NANO_TINY) || defined(ENABLE_SPELLER)
|
||||||
/* Block or unblock the SIGWINCH signal, depending on the blockit parameter. */
|
/* Block or unblock the SIGWINCH signal, depending on the blockit parameter. */
|
||||||
void block_sigwinch(bool blockit)
|
void block_sigwinch(bool blockit)
|
||||||
{
|
{
|
||||||
|
@ -1299,6 +1299,11 @@ void block_sigwinch(bool blockit)
|
||||||
sigemptyset(&winch);
|
sigemptyset(&winch);
|
||||||
sigaddset(&winch, SIGWINCH);
|
sigaddset(&winch, SIGWINCH);
|
||||||
sigprocmask(blockit ? SIG_BLOCK : SIG_UNBLOCK, &winch, NULL);
|
sigprocmask(blockit ? SIG_BLOCK : SIG_UNBLOCK, &winch, NULL);
|
||||||
|
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
if (the_window_resized)
|
||||||
|
regenerate_screen();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -424,7 +424,7 @@ RETSIGTYPE handle_crash(int signal);
|
||||||
#endif
|
#endif
|
||||||
RETSIGTYPE do_suspend(int signal);
|
RETSIGTYPE do_suspend(int signal);
|
||||||
RETSIGTYPE do_continue(int signal);
|
RETSIGTYPE do_continue(int signal);
|
||||||
#ifdef ENABLE_SPELLER
|
#if !defined(NANO_TINY) || defined(ENABLE_SPELLER)
|
||||||
void block_sigwinch(bool blockit);
|
void block_sigwinch(bool blockit);
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
|
Loading…
Reference in New Issue