chiark / gitweb /
random-seed: we should return errno of failed loop_write
authorLukas Nykryn <lnykryn@redhat.com>
Fri, 13 Sep 2013 12:12:55 +0000 (14:12 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 13 Sep 2013 12:32:14 +0000 (14:32 +0200)
src/random-seed/random-seed.c

index 4776c07..afbd500 100644 (file)
@@ -157,7 +157,7 @@ int main(int argc, char *argv[]) {
                 r = loop_write(seed_fd, buf, (size_t) k, false);
                 if (r <= 0) {
                         log_error("Failed to write new random seed file: %s", r < 0 ? strerror(-r) : "short write");
-                        r = k == 0 ? -EIO : (int) k;
+                        r = r == 0 ? -EIO : r;
                 }
         }