diff options
Diffstat (limited to 'sbin/restore/tape.c')
-rw-r--r-- | sbin/restore/tape.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c index a566c5acf339..4f3454901104 100644 --- a/sbin/restore/tape.c +++ b/sbin/restore/tape.c @@ -164,7 +164,11 @@ setinput(char *source, int ispipecommand) } pipein++; } - setuid(getuid()); /* no longer need or want root privileges */ + /* no longer need or want root privileges */ + if (setuid(getuid()) != 0) { + fprintf(stderr, "setuid failed\n"); + done(1); + } magtape = strdup(source); if (magtape == NULL) { fprintf(stderr, "Cannot allocate space for magtape buffer\n"); @@ -274,7 +278,7 @@ setup(void) done(1); } maxino = (spcl.c_count * TP_BSIZE * NBBY) + 1; - dprintf(stdout, "maxino = %d\n", maxino); + dprintf(stdout, "maxino = %ju\n", (uintmax_t)maxino); map = calloc((unsigned)1, (unsigned)howmany(maxino, NBBY)); if (map == NULL) panic("no memory for active inode map\n"); @@ -1050,8 +1054,9 @@ setupextattr(int extsize) } extbufsize = 0; extbuf = NULL; - fprintf(stderr, "Cannot extract %d bytes %s for inode %d, name %s\n", - extsize, "of extended attributes", curfile.ino, curfile.name); + fprintf(stderr, "Cannot extract %d bytes %s for inode %ju, name %s\n", + extsize, "of extended attributes", (uintmax_t)curfile.ino, + curfile.name); return (NULL); } @@ -1079,8 +1084,8 @@ xtrfile(char *buf, long size) return; if (write(ofile, buf, (int) size) == -1) { fprintf(stderr, - "write error extracting inode %d, name %s\nwrite: %s\n", - curfile.ino, curfile.name, strerror(errno)); + "write error extracting inode %ju, name %s\nwrite: %s\n", + (uintmax_t)curfile.ino, curfile.name, strerror(errno)); } } @@ -1094,8 +1099,8 @@ xtrskip(char *buf, long size) if (lseek(ofile, size, SEEK_CUR) == -1) { fprintf(stderr, - "seek error extracting inode %d, name %s\nlseek: %s\n", - curfile.ino, curfile.name, strerror(errno)); + "seek error extracting inode %ju, name %s\nlseek: %s\n", + (uintmax_t)curfile.ino, curfile.name, strerror(errno)); done(1); } } @@ -1243,8 +1248,8 @@ getmore: fprintf(stderr, "restoring %s\n", curfile.name); break; case SKIP: - fprintf(stderr, "skipping over inode %d\n", - curfile.ino); + fprintf(stderr, "skipping over inode %ju\n", + (uintmax_t)curfile.ino); break; } if (!yflag && !reply("continue")) @@ -1477,10 +1482,11 @@ accthdr(struct s_spcl *header) fprintf(stderr, "Used inodes map header"); break; case TS_INODE: - fprintf(stderr, "File header, ino %d", previno); + fprintf(stderr, "File header, ino %ju", (uintmax_t)previno); break; case TS_ADDR: - fprintf(stderr, "File continuation header, ino %d", previno); + fprintf(stderr, "File continuation header, ino %ju", + (uintmax_t)previno); break; case TS_END: fprintf(stderr, "End of tape header"); @@ -1631,8 +1637,8 @@ checksum(int *buf) } if (i != CHECKSUM) { - fprintf(stderr, "Checksum error %o, inode %d file %s\n", i, - curfile.ino, curfile.name); + fprintf(stderr, "Checksum error %o, inode %ju file %s\n", i, + (uintmax_t)curfile.ino, curfile.name); return(FAIL); } return(GOOD); |