mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-21 10:09:57 +01:00
gpg: Improve detection of input data read errors.
* g10/build-packet.c (do_plaintext): Better error checking for iobuf_copy. -- Fixes-commit: 695cb04af5218cd7b42c7eaaefc186472b99a995 GnuPG-bug-id: 6528 The original fix handles only the disk full case but didn't bother about read errors (i.e. I/O problems on an external drive).
This commit is contained in:
parent
9a741aba3d
commit
2cc340eca0
@ -1064,9 +1064,16 @@ do_plaintext( IOBUF out, int ctb, PKT_plaintext *pt )
|
||||
if (nbytes == (size_t)(-1)
|
||||
&& (iobuf_error (out) || iobuf_error (pt->buf)))
|
||||
return iobuf_error (out)? iobuf_error (out):iobuf_error (pt->buf);
|
||||
/* Always get the error to catch write errors because
|
||||
* iobuf_copy does not reliable return (-1) in that case. */
|
||||
rc = iobuf_error (out);
|
||||
else if (nbytes != (size_t)(-1) && iobuf_error (pt->buf))
|
||||
rc = iobuf_error (pt->buf); /* Read error. */
|
||||
else
|
||||
{
|
||||
/* Always get the iobuf error to catch write errors
|
||||
* because iobuf_copy returns (-1) only if there was a
|
||||
* errors in the output stream when entering that
|
||||
* function. */
|
||||
rc = iobuf_error (out);
|
||||
}
|
||||
if(ctb_new_format_p (ctb) && !pt->len)
|
||||
/* Turn off partial body length mode. */
|
||||
iobuf_set_partial_body_length_mode (out, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user