bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] af_alg: fix error handling when hash not returned


From: Pádraig Brady
Subject: [PATCH] af_alg: fix error handling when hash not returned
Date: Sun, 24 Jun 2018 01:43:38 -0700

* 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

[Prev in Thread] Current Thread [Next in Thread]