X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=dump%2Ftape.c;h=f4133942dd332a771d667c211c7c6c6a46bdea54;hb=d339304329df2d458e54c02eac10a27cb31d9cb1;hp=7790cc4e4bd6a30b8a8d6791699383265493195c;hpb=d1c73b9a3cd598653eb8b13531e8ca3c5c740d90;p=dump.git diff --git a/dump/tape.c b/dump/tape.c index 7790cc4..f413394 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.13 2000/02/26 01:35:48 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), @@ -730,10 +732,11 @@ restore_check_point: msg("Dumping volume %d on %s\n", tapeno, tape); } #ifdef RDUMP - while ((tapefd = (host ? rmtopen(tape, 2) : - pipeout ? 1 : open(tape, O_WRONLY|O_CREAT, 0666))) < 0) + while ((tapefd = (host ? rmtopen(tape, 2) : pipeout ? + fileno(stdout) : + open(tape, O_WRONLY|O_CREAT, 0666))) < 0) #else - while ((tapefd = (pipeout ? 1 : + while ((tapefd = (pipeout ? fileno(stdout) : open(tape, O_WRONLY|O_CREAT, 0666))) < 0) #endif { @@ -1029,8 +1032,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 +1049,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); }