files: make filtering of the entire buffer into a new buffer work again

This fixes https://savannah.gnu.org/bugs/?58076.

Bug existed since version 4.9, commit 477a9b33.
This commit is contained in:
Benno Schulenberg 2020-03-29 18:02:02 +02:00
parent 619962ee18
commit 8f6559828d
1 changed files with 5 additions and 1 deletions

View File

@ -1036,6 +1036,8 @@ bool execute_command(const char *command)
/* If the command starts with "|", pipe buffer or region to the command. */
if (should_pipe) {
linestruct *was_cutbuffer = cutbuffer;
bool whole_buffer = FALSE;
cutbuffer = NULL;
#ifdef ENABLE_MULTIBUFFER
@ -1043,6 +1045,8 @@ bool execute_command(const char *command)
openfile = openfile->prev;
if (openfile->mark)
do_snip(TRUE, TRUE, FALSE, FALSE);
else
whole_buffer = TRUE;
} else
#endif
{
@ -1059,7 +1063,7 @@ bool execute_command(const char *command)
/* Create a separate process for piping the data to the command. */
if (fork() == 0) {
send_data(cutbuffer, to_fd[1]);
send_data(whole_buffer ? openfile->filetop : cutbuffer, to_fd[1]);
exit(0);
}