wipefs: use write_all from include/writeall.h

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
This commit is contained in:
Petr Uzel 2011-02-04 09:05:58 +01:00 committed by Karel Zak
parent 8fdf2bf7b1
commit 0239ac01b0
1 changed files with 1 additions and 18 deletions

View File

@ -36,6 +36,7 @@
#include "nls.h"
#include "xalloc.h"
#include "strutils.h"
#include "writeall.h"
struct wipe_desc {
loff_t offset; /* magic string offset */
@ -212,24 +213,6 @@ read_offsets(struct wipe_desc *wp, const char *fname, int zap)
return wp;
}
static int
write_all(int fd, const void *buf, size_t count)
{
while(count) {
ssize_t tmp;
errno = 0;
tmp = write(fd, buf, count);
if (tmp > 0) {
count -= tmp;
if (count)
buf += tmp;
} else if (errno != EINTR && errno != EAGAIN)
return -1;
}
return 0;
}
static int
do_wipe_offset(int fd, struct wipe_desc *wp, const char *fname, int noact)
{