]> err.no Git - util-linux/commitdiff
Revert "mkswap: when writing the signature page, handle EINTR returns."
authorLaMont Jones <lamont@debian.org>
Tue, 15 Apr 2008 00:17:25 +0000 (18:17 -0600)
committerLaMont Jones <lamont@debian.org>
Tue, 15 Apr 2008 00:17:25 +0000 (18:17 -0600)
This reverts commit 5a913db9576f87ae9780d22de7d7f614e7f53dda.

disk-utils/mkswap.c

index dbbfa389fe021afe513b322281123ef4f6ac439a..4b1becafbdace898d908ec264018f18af819f5b9 100644 (file)
@@ -488,24 +488,6 @@ check_mount(void) {
        return 1;
 }
 
-static ssize_t
-write_all(int fd, const void *buf, size_t count) {
-       const unsigned char *b = buf;
-       ssize_t ret = 0;
-       ssize_t tmp;
-       do {
-               tmp = write(fd, b + ret, count - ret);
-               if (tmp > 0) {
-                       ret += tmp, b += tmp, count -= tmp;
-               } else if (tmp == 0) {
-                       break;          /* hit end of file... */
-               } else if (errno != EINTR && errno != EAGAIN) {
-                       return -1;
-               }
-       } while (ret < count && ret != -1);
-       return ret;
-}
-
 int
 main(int argc, char ** argv) {
        struct stat statbuf;
@@ -748,11 +730,8 @@ the -f option to force it.\n"),
        offset = ((version == 0) ? 0 : 1024);
        if (lseek(DEV, offset, SEEK_SET) != offset)
                die(_("unable to rewind swap-device"));
-       i=write_all(DEV,(char*)signature_page+offset, pagesize-offset);
-       if (i < 0)
-               fprintf(stderr, _("error writing swap signature: %s"),
-                       strerror(errno));
-       if (i != pagesize-offset)
+       if (write(DEV,(char*)signature_page+offset, pagesize-offset)
+           != pagesize-offset)
                die(_("unable to write signature page"));
 
        /*