Skip to content

Commit

Permalink
lib-sieve: program client: Fixed bug in handling of result code from …
Browse files Browse the repository at this point in the history
…remote program (script service).

It was sometimes passed through as data, meaning that the result code was missed.
This transiently resulted in programs seemingly returning invalid result codes, causing an error.
  • Loading branch information
stephanbosch committed Jul 7, 2016
1 parent aabde88 commit 70c2728
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib-sieve/util/program-client-remote.c
Expand Up @@ -86,8 +86,6 @@ static ssize_t program_client_istream_read(struct istream_private *stream)
}
}

if ( ret == 0 || (ret < 0 && !stream->parent->eof) ) break;

if ( stream->buffer != NULL && pos >= 1 ) {
/* retain/hide potential return code at end of buffer */
reserved = ( stream->buffer[pos-1] == '\n' && pos > 1 ? 2 : 1 );
Expand All @@ -99,6 +97,8 @@ static ssize_t program_client_istream_read(struct istream_private *stream)
}
}

if ( ret == 0 || (ret < 0 && !stream->parent->eof) ) break;

if ( ret <= 0 && stream->parent->eof ) {
/* Parent EOF and not more data to return; EOF here as well */
stream->istream.eof = TRUE;
Expand Down

0 comments on commit 70c2728

Please sign in to comment.