]> err.no Git - util-linux/commitdiff
mkswap: set errno=0 in write_all()
authorKarel Zak <kzak@redhat.com>
Wed, 16 Apr 2008 12:13:42 +0000 (14:13 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 16 Apr 2008 19:58:26 +0000 (21:58 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/mkswap.c

index dc3a3d308b81b387cf8c1fe4ee5f5baaf938ccbb..10068b7130515d6b1e61d7cac3ef10e1ad01aeb7 100644 (file)
@@ -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)