about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2018-01-03 19:08:42 +0100
committerLeah Neukirchen <leah@vuxu.org>2018-01-03 19:08:42 +0100
commit5e0f1d15e7f18760ccf9b4cc098af8525a31606d (patch)
treeb9485ecdda77a08ae7fa53133ad214f3aea3dea0
parentae274fa5a9754526c63e91e654b3da2fe0c9468f (diff)
downloadrdd-5e0f1d15e7f18760ccf9b4cc098af8525a31606d.tar.gz
rdd-5e0f1d15e7f18760ccf9b4cc098af8525a31606d.tar.xz
rdd-5e0f1d15e7f18760ccf9b4cc098af8525a31606d.zip
exit cleanly on ENOSPC
-rw-r--r--rdd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/rdd.c b/rdd.c
index 3513e37..c85380e 100644
--- a/rdd.c
+++ b/rdd.c
@@ -53,8 +53,12 @@ usage:
 		for (i = 0; r < 0 || i < r*1024*1024; i += sizeof buf) {
 			sosemanuk_prng(&rc, buf, sizeof buf);
 			while (write(1, buf, sizeof buf) != sizeof buf)
-				if (errno && errno != EINTR)
-					fail(4, "write error\n");
+				if (errno) {
+					if (errno == ENOSPC)
+						exit(0);
+					if (errno != EINTR)
+						fail(4, "write error\n");
+				}
 		}
 	}
 }