Index: sbin/restore/dirs.c
===================================================================
--- sbin/restore/dirs.c	(revision 358732)
+++ sbin/restore/dirs.c	(working copy)
@@ -147,11 +147,19 @@
 	if (command != 'r' && command != 'R') {
 		(void) strcat(dirfile, "-XXXXXX");
 		fd = mkstemp(dirfile);
-	} else
-		fd = open(dirfile, O_RDWR|O_CREAT|O_EXCL, 0666);
-	if (fd == -1 || (df = fdopen(fd, "w")) == NULL) {
+	} else {
+		do {
+			fd = open(dirfile, O_RDWR|O_CREAT|O_EXCL, 0666);
+		} while ((fd == -1) && (errno == EINTR));
+	}
+	if (fd != -1) {
+		do {
+			df = fdopen(fd, "w");
+		} while ((df == NULL) && (errno == EINTR));
+	}
+	if (fd == -1 || df == NULL) {
 		if (fd != -1)
-			close(fd);
+			while ((close(fd) == -1) && (errno == EINTR)) /* nop */;
 		warn("%s: cannot create directory database", dirfile);
 		done(1);
 	}
@@ -161,11 +169,20 @@
 		if (command != 'r' && command != 'R') {
 			(void) strcat(modefile, "-XXXXXX");
 			fd = mkstemp(modefile);
-		} else
-			fd = open(modefile, O_RDWR|O_CREAT|O_EXCL, 0666);
-		if (fd == -1 || (mf = fdopen(fd, "w")) == NULL) {
+		} else {
+			do {
+				fd = open(modefile, O_RDWR|O_CREAT|O_EXCL, 0666);
+			} while ((fd == -1) && (errno == EINTR));
+		}
+		if (fd != -1) {
+			do {
+				mf = fdopen(fd, "w");
+			} while ((mf == NULL) && (errno == EINTR));
+		}
+		if (fd == -1 || mf == NULL) {
 			if (fd != -1)
-				close(fd);
+				while ((close(fd) == -1) && (errno == EINTR))
+					/* nop */;
 			warn("%s: cannot create modefile", modefile);
 			done(1);
 		}
@@ -447,7 +464,10 @@
 	(void) lseek(dirp->dd_fd, base + rounddown2(loc, DIRBLKSIZ), SEEK_SET);
 	dirp->dd_loc = loc & (DIRBLKSIZ - 1);
 	if (dirp->dd_loc != 0)
-		dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf, DIRBLKSIZ);
+		do {
+			dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf,
+			    DIRBLKSIZ);
+		} while ((dirp->dd_size == -1) && (errno == EINTR));
 }
 
 /*
@@ -460,8 +480,10 @@
 
 	for (;;) {
 		if (dirp->dd_loc == 0) {
-			dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf,
-			    DIRBLKSIZ);
+			do {
+				dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf,
+				    DIRBLKSIZ);
+			} while ((dirp->dd_size == -1) && (errno == EINTR));
 			if (dirp->dd_size <= 0) {
 				dprintf(stderr, "error reading directory\n");
 				return (NULL);
@@ -518,7 +540,7 @@
 	RST_DIR *dirp;
 
 	dirp = arg;
-	(void)close(dirp->dd_fd);
+	while ((close(dirp->dd_fd) == -1) && (errno == EINTR)) /* nop */;
 	free(dirp);
 	return;
 }
@@ -542,10 +564,13 @@
 	RST_DIR *dirp;
 	int fd;
 
-	if ((fd = open(name, O_RDONLY)) == -1)
+	do {
+		fd = open(name, O_RDONLY);
+	} while ((fd == -1) && (errno == EINTR));
+	if (fd == -1)
 		return (NULL);
 	if ((dirp = malloc(sizeof(RST_DIR))) == NULL) {
-		(void)close(fd);
+		while ((close(fd) == -1) && (errno == EINTR)) /* nop */;
 		return (NULL);
 	}
 	dirp->dd_fd = fd;
@@ -578,7 +603,9 @@
 		fprintf(stderr, "directory mode, owner, and times not set\n");
 		return;
 	}
-	mf = fopen(modefile, "r");
+	do {
+		mf = fopen(modefile, "r");
+	} while ((mf == NULL) && (errno == EINTR));
 	if (mf == NULL) {
 		fprintf(stderr, "fopen: %s\n", strerror(errno));
 		fprintf(stderr, "cannot open mode file %s\n", modefile);
@@ -684,7 +711,10 @@
 	if (itp == NULL)
 		panic("Cannot find directory inode %ju named %s\n",
 		    (uintmax_t)ino, name);
-	if ((ofile = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) {
+	do {
+		ofile = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+	} while ((ofile == -1) && (errno == EINTR));
+	if (ofile < 0) {
 		fprintf(stderr, "%s: ", name);
 		(void) fflush(stderr);
 		fprintf(stderr, "cannot create file: %s\n", strerror(errno));
@@ -693,8 +723,12 @@
 	rst_seekdir(dirp, itp->t_seekpt, itp->t_seekpt);
 	dp = dup(dirp->dd_fd);
 	for (i = itp->t_size; i > 0; i -= BUFSIZ) {
+		int ret_val = 0;
 		size = MIN(i, BUFSIZ);
-		if (read(dp, buf, (int) size) == -1) {
+		do {
+			ret_val = read(dp, buf, (int) size);
+		} while ((ret_val == -1) && (errno == EINTR));
+		if (ret_val == -1) {
 			fprintf(stderr,
 			    "write error extracting inode %ju, name %s\n",
 			    (uintmax_t)curfile.ino, curfile.name);
@@ -709,8 +743,8 @@
 			done(1);
 		}
 	}
-	(void) close(dp);
-	(void) close(ofile);
+	while((close(dp) == -1) && (errno == EINTR)) /* nop */;
+	while((close(ofile) == -1) && (errno == EINTR)) /* nop */;
 	return (GOOD);
 }
 
Index: sbin/restore/symtab.c
===================================================================
--- sbin/restore/symtab.c	(revision 358732)
+++ sbin/restore/symtab.c	(working copy)
@@ -449,7 +449,10 @@
 	vprintf(stdout, "Checkpointing the restore\n");
 	if (Nflag)
 		return;
-	if ((fd = fopen(filename, "w")) == NULL) {
+	do {
+		fd = fopen(filename, "w");
+	} while ((fd == NULL) && (errno == EINTR));
+	if (fd == NULL) {
 		fprintf(stderr, "fopen: %s\n", strerror(errno));
 		panic("cannot create save file %s for symbol table\n",
 			filename);
@@ -532,7 +535,7 @@
 	struct symtableheader hdr;
 	struct stat stbuf;
 	long i;
-	int fd;
+	int fd, ret_val;
 
 	vprintf(stdout, "Initialize symbol table.\n");
 	if (filename == NULL) {
@@ -544,7 +547,10 @@
 		ep->e_flags |= NEW;
 		return;
 	}
-	if ((fd = open(filename, O_RDONLY, 0)) < 0) {
+	do {
+		fd = open(filename, O_RDONLY, 0);
+	} while ((fd == -1) && (errno == EINTR));
+	if (fd < 0) {
 		fprintf(stderr, "open: %s\n", strerror(errno));
 		panic("cannot open symbol table file %s\n", filename);
 	}
@@ -556,8 +562,10 @@
 	base = calloc(sizeof(char), (unsigned)tblsize);
 	if (base == NULL)
 		panic("cannot allocate space for symbol table\n");
-	if (read(fd, base, (int)tblsize) < 0 ||
-	    read(fd, (char *)&hdr, sizeof(struct symtableheader)) < 0) {
+	do {
+		ret_val = read(fd, base, (int)tblsize);
+	} while ((ret_val == -1) && (errno == EINTR));
+	if (ret_val == -1) {
 		fprintf(stderr, "read: %s\n", strerror(errno));
 		panic("cannot read symbol table file %s\n", filename);
 	}
Index: sbin/restore/tape.c
===================================================================
--- sbin/restore/tape.c	(revision 358732)
+++ sbin/restore/tape.c	(working copy)
@@ -152,11 +152,15 @@
 		 * Since input is coming from a pipe we must establish
 		 * our own connection to the terminal.
 		 */
-		terminal = fopen(_PATH_TTY, "r");
+		do {
+			terminal = fopen(_PATH_TTY, "r");
+		} while ((terminal == NULL) && (errno == EINTR));
 		if (terminal == NULL) {
 			(void)fprintf(stderr, "cannot open %s: %s\n",
 			    _PATH_TTY, strerror(errno));
-			terminal = fopen(_PATH_DEVNULL, "r");
+			do {
+				terminal = fopen(_PATH_DEVNULL, "r");
+			} while ((terminal == NULL) && (errno == EINTR));
 			if (terminal == NULL) {
 				(void)fprintf(stderr, "cannot open %s: %s\n",
 				    _PATH_DEVNULL, strerror(errno));
@@ -223,8 +227,11 @@
 #endif
 	if (pipein)
 		mt = 0;
-	else
-		mt = open(magtape, O_RDONLY, 0);
+	else {
+		do {
+			mt = open(magtape, O_RDONLY, 0);
+		} while ((mt == -1) && (errno == EINTR));
+	}
 	if (mt < 0) {
 		fprintf(stderr, "%s: %s\n", magtape, strerror(errno));
 		done(1);
@@ -418,7 +425,9 @@
 		mt = rmtopen(magtape, 0);
 	else
 #endif
-		mt = open(magtape, O_RDONLY, 0);
+		do {
+			mt = open(magtape, O_RDONLY, 0);
+		} while ((mt == -1) && (errno == EINTR));
 
 	if (mt == -1) {
 		fprintf(stderr, "Cannot open %s\n", magtape);
@@ -704,9 +713,11 @@
 			return (GOOD);
 		}
 		if (uflag)
-			(void) unlink(name);
-		if ((ofile = open(name, O_WRONLY | O_CREAT | O_TRUNC,
-		    0600)) < 0) {
+			(void)unlink(name);
+		do {
+			ofile = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+		} while ((ofile <0) && (errno == EINTR));
+		if (ofile < 0) {
 			fprintf(stderr, "%s: cannot create file: %s\n",
 			    name, strerror(errno));
 			skipfile();
@@ -721,7 +732,7 @@
 		(void) futimens(ofile, ctimep);
 		(void) futimens(ofile, mtimep);
 		(void) fchflags(ofile, flags);
-		(void) close(ofile);
+		while((close(ofile) == -1) && (errno == EINTR)) /* nop */;
 		return (GOOD);
 	}
 	/* NOTREACHED */
@@ -1150,7 +1161,9 @@
 		i = rmtread(&tapebuf[rd], cnt);
 	else
 #endif
-		i = read(mt, &tapebuf[rd], cnt);
+		do {
+			i = read(mt, &tapebuf[rd], cnt);
+		} while ((i == -1) && (errno == EINTR));
 	/*
 	 * Check for mid-tape short read error.
 	 * If found, skip rest of buffer and start with the next.
@@ -1261,7 +1274,9 @@
 		i = rmtread(tapebuf, ntrec * TP_BSIZE);
 	else
 #endif
-		i = read(mt, tapebuf, ntrec * TP_BSIZE);
+		do {
+			i = read(mt, tapebuf, ntrec * TP_BSIZE);
+		} while ((i == -1) && (errno == EINTR));
 
 	if (i <= 0) {
 		fprintf(stderr, "tape read error: %s\n", strerror(errno));
@@ -1292,7 +1307,7 @@
 		rmtclose();
 	else
 #endif
-		(void) close(mt);
+		while((close(mt) == -1) && (errno == EINTR)) /* nop */;
 }
 
 /*
