Index: sbin/dump/dumprmt.c =================================================================== RCS file: /import/FreeBSD-CVS/src/sbin/dump/dumprmt.c,v retrieving revision 1.22 diff -u -p -u -r1.22 dumprmt.c --- sbin/dump/dumprmt.c 10 Apr 2004 02:22:35 -0000 1.22 +++ sbin/dump/dumprmt.c 30 Jun 2004 21:30:05 -0000 @@ -110,7 +110,10 @@ rmtconnaborted(int sig __unused) int i; char buf[2048]; - if ((i = read(errfd, buf, sizeof(buf) - 1)) > 0) { + do { + i = read(errfd, buf, sizeof(buf)); + } while ((i == -1) && (errno == EINTR)); + if (i - 1 > 0) { buf[i] = '\0'; msg("on %s: %s%s", rmtpeer, buf, buf[i - 1] == '\n' ? "" : "\n"); @@ -229,7 +232,9 @@ rmtread(char *buf, int count) /* rmtcall() properly sets errno for us on errors. */ return (n); for (i = 0; i < n; i += cc) { - cc = read(rmtape, buf+i, n - i); + do { + cc = read(rmtape, buf+i, n - i); + } while ((cc == -1) && (errno == EINTR)); if (cc <= 0) rmtconnaborted(0); } @@ -347,8 +352,12 @@ int rmtgetb(void) { char c; + int ret_val; - if (read(rmtape, &c, 1) != 1) + do { + ret_val = read(rmtape, &c, 1); + } while ((ret_val == -1) && (errno == EINTR)); + if (ret_val != 1) rmtconnaborted(0); return (c); } Index: sbin/dump/itime.c =================================================================== RCS file: /import/FreeBSD-CVS/src/sbin/dump/itime.c,v retrieving revision 1.17 diff -u -p -u -r1.17 itime.c --- sbin/dump/itime.c 24 May 2008 05:20:46 -0000 1.17 +++ sbin/dump/itime.c 3 Jul 2008 09:16:41 -0000 @@ -71,7 +71,10 @@ initdumptimes(void) { FILE *df; - if ((df = fopen(dumpdates, "r")) == NULL) { + do { + df = fopen(dumpdates, "r"); + } while ((df == NULL) && (errno == EINTR)); + if (df == NULL) { if (errno != ENOENT) { msg("WARNING: cannot read %s: %s\n", dumpdates, strerror(errno)); @@ -81,13 +84,19 @@ initdumptimes(void) * Dumpdates does not exist, make an empty one. */ msg("WARNING: no file `%s', making an empty one\n", dumpdates); - if ((df = fopen(dumpdates, "w")) == NULL) { + do { + df = fopen(dumpdates, "w"); + } while ((df == NULL) && (errno == EINTR)); + if (df == NULL) { msg("WARNING: cannot create %s: %s\n", dumpdates, strerror(errno)); return; } (void) fclose(df); - if ((df = fopen(dumpdates, "r")) == NULL) { + do { + df = fopen(dumpdates, "r"); + } while ((df == NULL) && (errno == EINTR)); + if (df == NULL) { quit("cannot read %s even after creating it: %s\n", dumpdates, strerror(errno)); /* NOTREACHED */ @@ -167,7 +176,10 @@ putdumptime(void) if(uflag == 0) return; - if ((df = fopen(dumpdates, "r+")) == NULL) + do { + df = fopen(dumpdates, "r+"); + } while ((df == NULL) && (errno == EINTR)); + if (df == NULL) quit("cannot rewrite %s: %s\n", dumpdates, strerror(errno)); fd = fileno(df); (void) flock(fd, LOCK_EX); Index: sbin/dump/optr.c =================================================================== RCS file: /import/FreeBSD-CVS/src/sbin/dump/optr.c,v retrieving revision 1.35 diff -u -p -u -r1.35 optr.c --- sbin/dump/optr.c 6 Aug 2006 14:23:50 -0000 1.35 +++ sbin/dump/optr.c 9 Aug 2006 08:04:33 -0000 @@ -80,7 +80,10 @@ query(const char *question) int back, errcount; FILE *mytty; - if ((mytty = fopen(_PATH_TTY, "r")) == NULL) + do { + mytty = fopen(_PATH_TTY, "r"); + } while ((mytty == NULL) && (errno == EINTR)); + if (mytty == NULL) quit("fopen on %s fails: %s\n", _PATH_TTY, strerror(errno)); attnmessage = question; timeout = 0; Index: sbin/dump/tape.c =================================================================== RCS file: /import/FreeBSD-CVS/src/sbin/dump/tape.c,v retrieving revision 1.27 diff -u -p -u -r1.27 tape.c --- sbin/dump/tape.c 2 Mar 2005 02:30:08 -0000 1.27 +++ sbin/dump/tape.c 4 Mar 2005 19:55:08 -0000 @@ -327,7 +327,7 @@ trewind(void) quit("or use no size estimate at all.\n"); } } - (void) close(slaves[f].fd); + while ((close(slaves[f].fd) < 0) && (errno == EINTR)) /* nop */; } while (wait((int *)NULL) >= 0) /* wait for any signals from slaves */ /* void */; @@ -356,10 +356,10 @@ trewind(void) (void)close(tapefd); return; } - (void) close(tapefd); + while ((close(tapefd) < 0) && (errno == EINTR)) /* nop */; while ((f = open(tape, 0)) < 0) sleep (10); - (void) close(f); + while ((close(f) < 0) && (errno == EINTR)) /* nop */; } void @@ -720,7 +720,8 @@ enslave(void) slaves[i].sent = 0; if (slaves[i].pid == 0) { /* Slave starts up here */ for (j = 0; j <= i; j++) - (void) close(slaves[j].fd); + while ((close(slaves[j].fd) < 0) + && (errno == EINTR)) /* nop */; signal(SIGINT, SIG_IGN); /* Master handles this */ doslave(cmd[0], i); Exit(X_FINOK); @@ -763,8 +764,11 @@ doslave(int cmd, int slave_number) /* * Need our own seek pointer. */ - (void) close(diskfd); - if ((diskfd = open(disk, O_RDONLY)) < 0) + while ((close(diskfd) < 0) && (errno == EINTR)) /* nop */; + do { + diskfd = open(disk, O_RDONLY); + } while ((diskfd < 0) && (errno == EINTR)); + if (diskfd < 0) quit("slave couldn't reopen disk: %s\n", strerror(errno)); /* @@ -874,7 +878,13 @@ atomic(ssize_t (*func)(), int fd, char * { int got, need = count; - while ((got = (*func)(fd, buf, need)) > 0 && (need -= got) > 0) - buf += got; + do { + do { + got = (*func)(fd, buf, need); + } while ((got == -1) && (errno == EINTR)); + + if ((got > 0) && ((need -= got) > 0)) + buf += got; + } while (got > 0 && need > 0); return (got < 0 ? got : count - need); }