Harald Hoyer d4ee25
From 198884f22dc432a98e3d4423434b9e97d67f2da8 Mon Sep 17 00:00:00 2001
Harald Hoyer d4ee25
From: Lukas Nykryn <lnykryn@redhat.com>
Harald Hoyer d4ee25
Date: Fri, 13 Sep 2013 14:12:55 +0200
Harald Hoyer d4ee25
Subject: [PATCH] random-seed: we should return errno of failed loop_write
Harald Hoyer d4ee25
Harald Hoyer d4ee25
---
Harald Hoyer d4ee25
 src/random-seed/random-seed.c | 2 +-
Harald Hoyer d4ee25
 1 file changed, 1 insertion(+), 1 deletion(-)
Harald Hoyer d4ee25
Harald Hoyer d4ee25
diff --git a/src/random-seed/random-seed.c b/src/random-seed/random-seed.c
Harald Hoyer d4ee25
index 4776c07..afbd500 100644
Harald Hoyer d4ee25
--- a/src/random-seed/random-seed.c
Harald Hoyer d4ee25
+++ b/src/random-seed/random-seed.c
Harald Hoyer d4ee25
@@ -157,7 +157,7 @@ int main(int argc, char *argv[]) {
Harald Hoyer d4ee25
                 r = loop_write(seed_fd, buf, (size_t) k, false);
Harald Hoyer d4ee25
                 if (r <= 0) {
Harald Hoyer d4ee25
                         log_error("Failed to write new random seed file: %s", r < 0 ? strerror(-r) : "short write");
Harald Hoyer d4ee25
-                        r = k == 0 ? -EIO : (int) k;
Harald Hoyer d4ee25
+                        r = r == 0 ? -EIO : r;
Harald Hoyer d4ee25
                 }
Harald Hoyer d4ee25
         }
Harald Hoyer d4ee25