X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=dump%2Ftape.c;h=b3964a8336512054dc957f16524c27003d928ff1;hb=8eb05297aafdfd88bbd946a35d4db771604503bd;hp=7790cc4e4bd6a30b8a8d6791699383265493195c;hpb=d1c73b9a3cd598653eb8b13531e8ca3c5c740d90;p=dump.git diff --git a/dump/tape.c b/dump/tape.c index 7790cc4..b3964a8 100644 --- a/dump/tape.c +++ b/dump/tape.c @@ -2,7 +2,7 @@ * Ported to Linux's Second Extended File System as part of the * dump and restore backup suit * Remy Card , 1994-1997 - * Stelian Pop , 1999 + * Stelian Pop , 1999-2000 */ /*- @@ -40,7 +40,7 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.9 1999/11/21 16:01:47 tiniou Exp $"; + "$Id: tape.c,v 1.12 2000/02/10 09:42:32 stelian Exp $"; #endif /* not lint */ #ifdef __linux__ @@ -311,6 +311,8 @@ statussig(int notused) #else (void) time((time_t *) &tnow); #endif + if (blockswritten > tapesize) + tapesize = blockswritten; deltat = tstart_writing - tnow + (1.0 * (tnow - tstart_writing)) / blockswritten * tapesize; (void)snprintf(msgbuf, sizeof(msgbuf), @@ -1029,8 +1031,10 @@ atomic_read(int fd, void *buf, size_t count) { int got, need = count; - while ((got = read(fd, buf, need)) > 0 && (need -= got) > 0) - (char *)buf += got; + do { + while ((got = read(fd, buf, need)) > 0 && (need -= got) > 0) + (char *)buf += got; + } while (got == -1 && errno == EINTR); return (got < 0 ? got : count - need); } @@ -1044,7 +1048,9 @@ atomic_write(int fd, const void *buf, size_t count) { int got, need = count; - while ((got = write(fd, buf, need)) > 0 && (need -= got) > 0) - (char *)buf += got; + do { + while ((got = write(fd, buf, need)) > 0 && (need -= got) > 0) + (char *)buf += got; + } while (got == -1 && errno == EINTR); return (got < 0 ? got : count - need); }