Mercurial > gnulib
changeset 39706:21fef17e5c30
af_alg: fix error handling when hash not returned
* lib/af_alg.c (afalg_stream): Handle the case where we've
successfully written data to the kernel in the read/write loop,
but the kernel doesn't respond with the hash.
author | Pádraig Brady <P@draigBrady.com> |
---|---|
date | Sun, 24 Jun 2018 01:29:55 -0700 |
parents | 1f6103340f7c |
children | 5fd4481b1d32 |
files | ChangeLog lib/af_alg.c |
diffstat | 2 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Jun 24 08:50:36 2018 -0700 +++ b/ChangeLog Sun Jun 24 01:29:55 2018 -0700 @@ -32,6 +32,13 @@ * tests/test-wcwidth.c (main): If the wchar-single module is present, skip the tests in the C locale. +2018-06-24 Pádraig Brady <P@draigBrady.com> + + af_alg: fix error handling when hash not returned + * lib/af_alg.c (afalg_stream): Handle the case where we've + successfully written data to the kernel in the read/write loop, + but the kernel doesn't respond with the hash. + 2018-06-23 Pádraig Brady <P@draigBrady.com> crypto: mention --without-linux-crypto in --with-openssl --help
--- a/lib/af_alg.c Sun Jun 24 08:50:36 2018 -0700 +++ b/lib/af_alg.c Sun Jun 24 01:29:55 2018 -0700 @@ -145,7 +145,12 @@ } if (result == 0 && read (ofd, resblock, hashlen) != hashlen) - result = -EAFNOSUPPORT; + { + if (nseek == 0 || fseeko (stream, nseek, SEEK_CUR) == 0) + result = -EAFNOSUPPORT; + else + result = -EIO; + } close (ofd); return result; }