summaryrefslogtreecommitdiff
path: root/disk-utils
diff options
context:
space:
mode:
Diffstat (limited to 'disk-utils')
-rw-r--r--disk-utils/mkswap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c
index dc3a3d30..10068b71 100644
--- a/disk-utils/mkswap.c
+++ b/disk-utils/mkswap.c
@@ -469,8 +469,10 @@ check_mount(void) {
static int
write_all(int fd, const void *buf, size_t count) {
while(count) {
- ssize_t tmp = write(fd, buf, count);
+ ssize_t tmp;
+ errno = 0;
+ tmp = write(fd, buf, count);
if (tmp > 0) {
count -= tmp;
if (count)