diff options
-rw-r--r-- | debian/changelog | 14 | ||||
-rw-r--r-- | disk-utils/mkswap.c | 25 |
2 files changed, 36 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog index 43558554..8c72f628 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,17 @@ +util-linux (2.13.1-5) unstable; urgency=low + + * Switch to upstream's more-correct fix for LP#206113 + * mkswap: when writing the signature page, handle EINTR returns. LP: #206113 + + -- LaMont Jones <lamont@debian.org> Mon, 14 Apr 2008 18:18:30 -0600 + +util-linux (2.13.1-4) unstable; urgency=low + + * meta: Drop bashism in preinst. Closes: #472248 + * mkswap: when writing the signature page, handle EINTR returns. LP: #206113 + + -- LaMont Jones <lamont@debian.org> Fri, 11 Apr 2008 21:01:29 -0600 + util-linux (2.13.1-3) unstable; urgency=low [Kees Cook] diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c index 12d9a164..dc3a3d30 100644 --- a/disk-utils/mkswap.c +++ b/disk-utils/mkswap.c @@ -465,6 +465,22 @@ check_mount(void) { return 1; } + +static int +write_all(int fd, const void *buf, size_t count) { + while(count) { + ssize_t tmp = write(fd, buf, count); + + if (tmp > 0) { + count -= tmp; + if (count) + buf += tmp; + } else if (errno != EINTR && errno != EAGAIN) + return -1; + } + return 0; +} + int main(int argc, char ** argv) { struct stat statbuf; @@ -711,9 +727,12 @@ use 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")); - if (write(DEV,(char*)signature_page+offset, pagesize-offset) - != pagesize-offset) - die(_("unable to write signature page")); + if (write_all(DEV, (char *) signature_page + offset, + pagesize - offset) == -1) { + fprintf(stderr, _("%s: %s: unable to write signature page: %s"), + program_name, device_name, strerror(errno)); + exit(1); + } /* * A subsequent swapon() will fail if the signature |