* 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.
---
 lib/af_alg.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/af_alg.c b/lib/af_alg.c
index ded4b32..f362cab 100644
--- a/lib/af_alg.c
+++ b/lib/af_alg.c
@@ -145,7 +145,12 @@ afalg_stream (FILE *stream, const char *alg,
     }
 
   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;
 }
-- 
2.9.3


Reply via email to