Change all the 'return(x)' to 'return c'.
Makes some other searches I want to do a bit easier.
This commit is contained in:
parent
2177e61d69
commit
cdec4ac10c
130
bin/pax/ar_io.c
130
bin/pax/ar_io.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ar_io.c,v 1.46 2005/05/01 02:59:28 christos Exp $ */
|
||||
/* $NetBSD: ar_io.c,v 1.47 2006/02/11 10:43:17 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
|
@ -42,7 +42,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: ar_io.c,v 1.46 2005/05/01 02:59:28 christos Exp $");
|
||||
__RCSID("$NetBSD: ar_io.c,v 1.47 2006/02/11 10:43:17 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -192,14 +192,14 @@ ar_open(const char *name)
|
|||
*/
|
||||
arcname = NONE;
|
||||
lstrval = 1;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
if (arfd < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
if (chdname != NULL)
|
||||
if (dochdir(chdname) == -1)
|
||||
return(-1);
|
||||
return -1;
|
||||
/*
|
||||
* set up is based on device type
|
||||
*/
|
||||
|
@ -208,7 +208,7 @@ ar_open(const char *name)
|
|||
(void)close(arfd);
|
||||
arfd = -1;
|
||||
can_unlnk = 0;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
if (S_ISDIR(arsb.st_mode)) {
|
||||
tty_warn(0, "Cannot write an archive on top of a directory %s",
|
||||
|
@ -216,7 +216,7 @@ ar_open(const char *name)
|
|||
(void)close(arfd);
|
||||
arfd = -1;
|
||||
can_unlnk = 0;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (S_ISCHR(arsb.st_mode)) {
|
||||
|
@ -262,7 +262,7 @@ ar_open(const char *name)
|
|||
if (act == ARCHIVE) {
|
||||
blksz = rdblksz = wrblksz;
|
||||
lstrval = 1;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -355,7 +355,7 @@ ar_open(const char *name)
|
|||
break;
|
||||
}
|
||||
lstrval = 1;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -537,7 +537,7 @@ ar_set_wr(void)
|
|||
* Add any device dependent code as required here
|
||||
*/
|
||||
if (artyp != ISREG)
|
||||
return(0);
|
||||
return 0;
|
||||
/*
|
||||
* Ok we have an archive in a regular file. If we were rewriting a
|
||||
* file, we must get rid of all the stuff after the current offset
|
||||
|
@ -546,9 +546,9 @@ ar_set_wr(void)
|
|||
if (((cpos = lseek(arfd, (off_t)0L, SEEK_CUR)) < 0) ||
|
||||
(ftruncate(arfd, cpos) < 0)) {
|
||||
syswarn(1, errno, "Unable to truncate archive file");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -566,15 +566,15 @@ ar_app_ok(void)
|
|||
if (artyp == ISPIPE) {
|
||||
tty_warn(1,
|
||||
"Cannot append to an archive obtained from a pipe.");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!invld_rec)
|
||||
return(0);
|
||||
return 0;
|
||||
tty_warn(1,
|
||||
"Cannot append, device record size %d does not support %s spec",
|
||||
rdblksz, argv0);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef SYS_NO_RESTART
|
||||
|
@ -594,7 +594,7 @@ read_with_restart(int fd, void *buf, int bsz)
|
|||
while (((r = read(fd, buf, bsz)) < 0) && errno == EINTR)
|
||||
continue;
|
||||
|
||||
return(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -612,7 +612,7 @@ rmtread_with_restart(int fd, void *buf, int bsz)
|
|||
while (((r = rmtread(fd, buf, bsz)) < 0) && errno == EINTR)
|
||||
continue;
|
||||
|
||||
return(r);
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -644,7 +644,7 @@ xread(int fd, void *buf, int bsz)
|
|||
nread += r;
|
||||
} while (bsz > 0);
|
||||
|
||||
return(nread ? nread : r);
|
||||
return nread ? nread : r;
|
||||
}
|
||||
|
||||
#ifdef SYS_NO_RESTART
|
||||
|
@ -664,7 +664,7 @@ write_with_restart(int fd, void *buf, int bsz)
|
|||
while (((r = write(fd, buf, bsz)) < 0) && errno == EINTR)
|
||||
;
|
||||
|
||||
return(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -683,7 +683,7 @@ rmtwrite_with_restart(int fd, void *buf, int bsz)
|
|||
while (((r = rmtwrite(fd, buf, bsz)) < 0) && errno == EINTR)
|
||||
;
|
||||
|
||||
return(r);
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -715,7 +715,7 @@ xwrite(int fd, void *buf, int bsz)
|
|||
written += r;
|
||||
} while (bsz > 0);
|
||||
|
||||
return(written ? written : r);
|
||||
return written ? written : r;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -736,7 +736,7 @@ ar_read(char *buf, int cnt)
|
|||
* if last i/o was in error, no more reads until reset or new volume
|
||||
*/
|
||||
if (lstrval <= 0)
|
||||
return(lstrval);
|
||||
return lstrval;
|
||||
|
||||
/*
|
||||
* how we read must be based on device type
|
||||
|
@ -774,7 +774,7 @@ ar_read(char *buf, int cnt)
|
|||
if (rdblksz % BLKMULT)
|
||||
invld_rec = 1;
|
||||
}
|
||||
return(res);
|
||||
return res;
|
||||
}
|
||||
break;
|
||||
case ISREG:
|
||||
|
@ -791,7 +791,7 @@ ar_read(char *buf, int cnt)
|
|||
*/
|
||||
if ((res = read_with_restart(arfd, buf, cnt)) > 0) {
|
||||
io_ok = 1;
|
||||
return(res);
|
||||
return res;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -804,7 +804,7 @@ ar_read(char *buf, int cnt)
|
|||
syswarn(1, errno, "Failed read on archive volume %d", arvol);
|
||||
else
|
||||
tty_warn(0, "End of archive volume %d reached", arvol);
|
||||
return(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -829,12 +829,12 @@ ar_write(char *buf, int bsz)
|
|||
* an archive volume prevent further writes to it.
|
||||
*/
|
||||
if (lstrval <= 0)
|
||||
return(lstrval);
|
||||
return lstrval;
|
||||
|
||||
if ((res = xwrite(arfd, buf, bsz)) == bsz) {
|
||||
wr_trail = 1;
|
||||
io_ok = 1;
|
||||
return(bsz);
|
||||
return bsz;
|
||||
}
|
||||
/*
|
||||
* write broke, see what we can do with it. We try to send any partial
|
||||
|
@ -885,7 +885,7 @@ ar_write(char *buf, int bsz)
|
|||
tty_warn(0,
|
||||
"Write failed, archive is write protected.");
|
||||
res = lstrval = 0;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* see if we reached the end of media, if so force a change to
|
||||
|
@ -923,7 +923,7 @@ ar_write(char *buf, int bsz)
|
|||
if (!wr_trail && (res <= 0)) {
|
||||
tty_warn(1,
|
||||
"Unable to append, trailer re-write failed. Quitting.");
|
||||
return(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
if (res == 0)
|
||||
|
@ -935,7 +935,7 @@ ar_write(char *buf, int bsz)
|
|||
"WARNING: partial archive write. Archive MAY BE FLAWED");
|
||||
else
|
||||
tty_warn(1,"WARNING: partial archive write. Archive IS FLAWED");
|
||||
return(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -962,11 +962,11 @@ ar_rdsync(void)
|
|||
* we need to go to the next volume not try a resync
|
||||
*/
|
||||
if ((done > 0) || (lstrval == 0))
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
if ((act == APPND) || (act == ARCHIVE)) {
|
||||
tty_warn(1, "Cannot allow updates to an archive with flaws.");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
if (io_ok)
|
||||
did_io = 1;
|
||||
|
@ -1034,10 +1034,10 @@ ar_rdsync(void)
|
|||
}
|
||||
if (lstrval <= 0) {
|
||||
tty_warn(1, "Unable to recover from an archive read failure.");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
tty_warn(0, "Attempting to recover from an archive read failure.");
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1058,13 +1058,13 @@ ar_fow(off_t sksz, off_t *skipped)
|
|||
|
||||
*skipped = 0;
|
||||
if (sksz <= 0)
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* we cannot move forward at EOF or error
|
||||
*/
|
||||
if (lstrval <= 0)
|
||||
return(lstrval);
|
||||
return lstrval;
|
||||
|
||||
/*
|
||||
* Safer to read forward on devices where it is hard to find the end of
|
||||
|
@ -1077,7 +1077,7 @@ ar_fow(off_t sksz, off_t *skipped)
|
|||
|| artyp == ISRMT
|
||||
#endif /* SUPPORT_RMT */
|
||||
)
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* figure out where we are in the archive
|
||||
|
@ -1094,15 +1094,15 @@ ar_fow(off_t sksz, off_t *skipped)
|
|||
mpos = arsb.st_size;
|
||||
if ((mpos = lseek(arfd, mpos, SEEK_SET)) >= 0) {
|
||||
*skipped = mpos - cpos;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (artyp != ISREG)
|
||||
return(0); /* non-seekable device */
|
||||
return 0; /* non-seekable device */
|
||||
}
|
||||
syswarn(1, errno, "Forward positioning operation on archive failed");
|
||||
lstrval = -1;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1129,7 +1129,7 @@ ar_rev(off_t sksz)
|
|||
* make sure we do not have try to reverse on a flawed archive
|
||||
*/
|
||||
if (lstrval < 0)
|
||||
return(lstrval);
|
||||
return lstrval;
|
||||
|
||||
switch(artyp) {
|
||||
case ISPIPE:
|
||||
|
@ -1140,7 +1140,7 @@ ar_rev(off_t sksz)
|
|||
*/
|
||||
tty_warn(1, "Reverse positioning on pipes is not supported.");
|
||||
lstrval = -1;
|
||||
return(-1);
|
||||
return -1;
|
||||
case ISREG:
|
||||
case ISBLK:
|
||||
case ISCHR:
|
||||
|
@ -1159,7 +1159,7 @@ ar_rev(off_t sksz)
|
|||
syswarn(1, errno,
|
||||
"Unable to obtain current archive byte offset");
|
||||
lstrval = -1;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1177,14 +1177,14 @@ ar_rev(off_t sksz)
|
|||
tty_warn(1,
|
||||
"Reverse position on previous volume.");
|
||||
lstrval = -1;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
cpos = (off_t)0L;
|
||||
}
|
||||
if (lseek(arfd, cpos, SEEK_SET) < 0) {
|
||||
syswarn(1, errno, "Unable to seek archive backwards");
|
||||
lstrval = -1;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case ISTAPE:
|
||||
|
@ -1201,7 +1201,7 @@ ar_rev(off_t sksz)
|
|||
*/
|
||||
if ((phyblk = get_phys()) <= 0) {
|
||||
lstrval = -1;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1224,7 +1224,7 @@ ar_rev(off_t sksz)
|
|||
tty_warn(1,
|
||||
"Tape drive unable to backspace requested amount");
|
||||
lstrval = -1;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1242,7 +1242,7 @@ ar_rev(off_t sksz)
|
|||
syswarn(1, errno, "Unable to backspace tape %ld blocks.",
|
||||
(long) mb.mt_count);
|
||||
lstrval = -1;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
tty_warn(1, "System does not have tape support");
|
||||
|
@ -1250,7 +1250,7 @@ ar_rev(off_t sksz)
|
|||
break;
|
||||
}
|
||||
lstrval = 1;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_MTIO_H
|
||||
|
@ -1293,7 +1293,7 @@ get_phys(void)
|
|||
padsz += res;
|
||||
if (res < 0) {
|
||||
syswarn(1, errno, "Unable to locate tape filemark.");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1311,7 +1311,7 @@ get_phys(void)
|
|||
#endif /* SUPPORT_RMT */
|
||||
< 0) {
|
||||
syswarn(1, errno, "Unable to backspace over tape filemark.");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1328,7 +1328,7 @@ get_phys(void)
|
|||
#endif /* SUPPORT_RMT */
|
||||
< 0) {
|
||||
syswarn(1, errno, "Unable to backspace over last tape block.");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
if ((phyblk =
|
||||
#ifdef SUPPORT_RMT
|
||||
|
@ -1338,7 +1338,7 @@ get_phys(void)
|
|||
#endif /* SUPPORT_RMT */
|
||||
) <= 0) {
|
||||
syswarn(1, errno, "Cannot determine archive tape blocksize.");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1355,7 +1355,7 @@ get_phys(void)
|
|||
;
|
||||
if (res < 0) {
|
||||
syswarn(1, errno, "Unable to locate tape filemark.");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
mb.mt_op = MTBSF;
|
||||
mb.mt_count = 1;
|
||||
|
@ -1367,7 +1367,7 @@ get_phys(void)
|
|||
#endif /* SUPPORT_RMT */
|
||||
< 0) {
|
||||
syswarn(1, errno, "Unable to backspace over tape filemark.");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1379,7 +1379,7 @@ get_phys(void)
|
|||
* return if there was no padding
|
||||
*/
|
||||
if (padsz == 0)
|
||||
return(phyblk);
|
||||
return phyblk;
|
||||
|
||||
/*
|
||||
* make sure we can move backwards over the padding. (this should
|
||||
|
@ -1387,7 +1387,7 @@ get_phys(void)
|
|||
*/
|
||||
if (padsz % phyblk) {
|
||||
tty_warn(1, "Tape drive unable to backspace requested amount");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1406,9 +1406,9 @@ get_phys(void)
|
|||
syswarn(1, errno,
|
||||
"Unable to backspace tape over %ld pad blocks",
|
||||
(long)mb.mt_count);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(phyblk);
|
||||
return phyblk;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1441,7 +1441,7 @@ ar_next(void)
|
|||
syswarn(0, errno, "Unable to restore signal mask");
|
||||
|
||||
if (done || !wr_trail || force_one_volume)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
if (!is_gnutar)
|
||||
tty_prnt("\nATTENTION! %s archive volume change required.\n",
|
||||
|
@ -1484,7 +1484,7 @@ ar_next(void)
|
|||
lstrval = -1;
|
||||
tty_prnt("Quitting %s!\n", argv0);
|
||||
vfpart = 0;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((buf[0] == '\0') || (buf[1] != '\0')) {
|
||||
|
@ -1499,7 +1499,7 @@ ar_next(void)
|
|||
* we are to continue with the same device
|
||||
*/
|
||||
if (ar_open(arcname) >= 0)
|
||||
return(0);
|
||||
return 0;
|
||||
tty_prnt("Cannot re-open %s, try again\n",
|
||||
arcname);
|
||||
continue;
|
||||
|
@ -1536,7 +1536,7 @@ ar_next(void)
|
|||
lstrval = -1;
|
||||
tty_prnt("Quitting %s!\n", argv0);
|
||||
vfpart = 0;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
if (buf[0] == '\0') {
|
||||
tty_prnt("Empty file name, try again\n");
|
||||
|
@ -1563,7 +1563,7 @@ ar_next(void)
|
|||
done = 1;
|
||||
lstrval = -1;
|
||||
tty_warn(0, "Cannot save archive name.");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
arcname = arcfree;
|
||||
break;
|
||||
|
@ -1571,7 +1571,7 @@ ar_next(void)
|
|||
tty_prnt("Cannot open %s, try again\n", buf);
|
||||
continue;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ar_subs.c,v 1.47 2006/01/31 19:25:20 christos Exp $ */
|
||||
/* $NetBSD: ar_subs.c,v 1.48 2006/02/11 10:43:17 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
|
@ -42,7 +42,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)ar_subs.c 8.2 (Berkeley) 4/18/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: ar_subs.c,v 1.47 2006/01/31 19:25:20 christos Exp $");
|
||||
__RCSID("$NetBSD: ar_subs.c,v 1.48 2006/02/11 10:43:17 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -1180,7 +1180,7 @@ next_head(ARCHD *arcn)
|
|||
* them, so exit gracefully.
|
||||
*/
|
||||
if (first && ret == 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
first = 0;
|
||||
|
||||
/*
|
||||
|
@ -1190,13 +1190,13 @@ next_head(ARCHD *arcn)
|
|||
if ((ret == 0) || (rd_sync() < 0)) {
|
||||
tty_warn(1,
|
||||
"Premature end of file on archive read");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
if (!in_resync) {
|
||||
if (act == APPND) {
|
||||
tty_warn(1,
|
||||
"Archive I/O error, cannot continue");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
tty_warn(1,
|
||||
"Archive I/O error. Trying to recover.");
|
||||
|
@ -1234,7 +1234,7 @@ next_head(ARCHD *arcn)
|
|||
* valid trailer found, drain input as required
|
||||
*/
|
||||
ar_drain();
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ret == 1) {
|
||||
|
@ -1262,7 +1262,7 @@ next_head(ARCHD *arcn)
|
|||
if (act == APPND) {
|
||||
tty_warn(1,
|
||||
"Unable to append, archive header flaw");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
tty_warn(1,
|
||||
"Invalid header, starting valid header search.");
|
||||
|
@ -1283,11 +1283,11 @@ next_head(ARCHD *arcn)
|
|||
* valid trailer found, drain input as required
|
||||
*/
|
||||
ar_drain();
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
++flcnt;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1319,7 +1319,7 @@ get_arc(void)
|
|||
minhd = fsub[ford[i]].hsz;
|
||||
}
|
||||
if (rd_start() < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
res = BLKMULT;
|
||||
hdsz = 0;
|
||||
hdend = hdbuf;
|
||||
|
@ -1351,7 +1351,7 @@ get_arc(void)
|
|||
hdend = hdbuf;
|
||||
if (!notice) {
|
||||
if (act == APPND)
|
||||
return(-1);
|
||||
return -1;
|
||||
tty_warn(1,
|
||||
"Cannot identify format. Searching...");
|
||||
++notice;
|
||||
|
@ -1378,7 +1378,7 @@ get_arc(void)
|
|||
* adding all the special case code is far worse.
|
||||
*/
|
||||
pback(hdbuf, hdsz);
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1387,7 +1387,7 @@ get_arc(void)
|
|||
*/
|
||||
if (!notice) {
|
||||
if (act == APPND)
|
||||
return(-1);
|
||||
return -1;
|
||||
tty_warn(1, "Cannot identify format. Searching...");
|
||||
++notice;
|
||||
}
|
||||
|
@ -1414,5 +1414,5 @@ get_arc(void)
|
|||
* we cannot find a header, bow, apologize and quit
|
||||
*/
|
||||
tty_warn(1, "Sorry, unable to determine archive format.");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: buf_subs.c,v 1.26 2005/04/24 03:26:03 christos Exp $ */
|
||||
/* $NetBSD: buf_subs.c,v 1.27 2006/02/11 10:43:18 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
|
@ -42,7 +42,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)buf_subs.c 8.2 (Berkeley) 4/18/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: buf_subs.c,v 1.26 2005/04/24 03:26:03 christos Exp $");
|
||||
__RCSID("$NetBSD: buf_subs.c,v 1.27 2006/02/11 10:43:18 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -106,12 +106,12 @@ wr_start(void)
|
|||
if (wrblksz > MAXBLK) {
|
||||
tty_warn(1, "Write block size of %d too large, maximum is: %d",
|
||||
wrblksz, MAXBLK);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
if (wrblksz % BLKMULT) {
|
||||
tty_warn(1, "Write block size of %d is not a %d byte multiple",
|
||||
wrblksz, BLKMULT);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -119,11 +119,11 @@ wr_start(void)
|
|||
*/
|
||||
blksz = rdblksz = wrblksz;
|
||||
if ((ar_open(arcname) < 0) && (ar_next() < 0))
|
||||
return(-1);
|
||||
return -1;
|
||||
wrcnt = 0;
|
||||
bufend = buf + wrblksz;
|
||||
bufpt = buf;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -147,13 +147,13 @@ rd_start(void)
|
|||
tty_warn(1,
|
||||
"Write block size %d too large, maximum is: %d",
|
||||
wrblksz, MAXBLK);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
if (wrblksz % BLKMULT) {
|
||||
tty_warn(1,
|
||||
"Write block size %d is not a %d byte multiple",
|
||||
wrblksz, BLKMULT);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,11 +161,11 @@ rd_start(void)
|
|||
* open the archive
|
||||
*/
|
||||
if ((ar_open(arcname) < 0) && (ar_next() < 0))
|
||||
return(-1);
|
||||
return -1;
|
||||
bufend = buf + rdblksz;
|
||||
bufpt = bufend;
|
||||
rdcnt = 0;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -220,7 +220,7 @@ appnd_start(off_t skcnt)
|
|||
|
||||
if (exit_val != 0) {
|
||||
tty_warn(0, "Cannot append to an archive that may have flaws.");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
* if the user did not specify a write blocksize, inherit the size used
|
||||
|
@ -236,7 +236,7 @@ appnd_start(off_t skcnt)
|
|||
* make sure that this volume allows appends
|
||||
*/
|
||||
if (ar_app_ok() < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* Calculate bytes to move back and move in front of record where we
|
||||
|
@ -291,13 +291,13 @@ appnd_start(off_t skcnt)
|
|||
* ARCHIVE mode (write) conditions
|
||||
*/
|
||||
if (ar_set_wr() < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
act = ARCHIVE;
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
out:
|
||||
tty_warn(1, "Unable to rewrite archive trailer, cannot append.");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -321,11 +321,11 @@ rd_sync(void)
|
|||
* if the user says bail out on first fault, we are out of here...
|
||||
*/
|
||||
if (maxflt == 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
if (act == APPND) {
|
||||
tty_warn(1,
|
||||
"Unable to append when there are archive read errors.");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -333,7 +333,7 @@ rd_sync(void)
|
|||
*/
|
||||
if (ar_rdsync() < 0) {
|
||||
if (ar_next() < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
else
|
||||
rdcnt = 0;
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ rd_sync(void)
|
|||
bufpt = buf;
|
||||
bufend = buf + res;
|
||||
rdcnt += res;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -367,7 +367,7 @@ rd_sync(void)
|
|||
rdcnt = 0;
|
||||
errcnt = 0;
|
||||
}
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -411,7 +411,7 @@ rd_skip(off_t skcnt)
|
|||
* do not want.
|
||||
*/
|
||||
if (skcnt == 0)
|
||||
return(0);
|
||||
return 0;
|
||||
res = MIN((bufend - bufpt), skcnt);
|
||||
bufpt += res;
|
||||
skcnt -= res;
|
||||
|
@ -420,7 +420,7 @@ rd_skip(off_t skcnt)
|
|||
* if skcnt is now 0, then no additional i/o is needed
|
||||
*/
|
||||
if (skcnt == 0)
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* We have to read more, calculate complete and partial record reads
|
||||
|
@ -434,7 +434,7 @@ rd_skip(off_t skcnt)
|
|||
* how much it can skip over. We will have to read the rest.
|
||||
*/
|
||||
if (ar_fow(cnt, &skipped) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
res += cnt - skipped;
|
||||
rdcnt += skipped;
|
||||
|
||||
|
@ -448,14 +448,14 @@ rd_skip(off_t skcnt)
|
|||
* if the read fails, we will have to resync
|
||||
*/
|
||||
if ((cnt <= 0) && ((cnt = buf_fill()) < 0))
|
||||
return(-1);
|
||||
return -1;
|
||||
if (cnt == 0)
|
||||
return(1);
|
||||
return 1;
|
||||
cnt = MIN(cnt, res);
|
||||
bufpt += cnt;
|
||||
res -= cnt;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -499,7 +499,7 @@ wr_rdbuf(char *out, int outcnt)
|
|||
while (outcnt > 0) {
|
||||
cnt = bufend - bufpt;
|
||||
if ((cnt <= 0) && ((cnt = buf_flush(blksz)) < 0))
|
||||
return(-1);
|
||||
return -1;
|
||||
/*
|
||||
* only move what we have space for
|
||||
*/
|
||||
|
@ -509,7 +509,7 @@ wr_rdbuf(char *out, int outcnt)
|
|||
out += cnt;
|
||||
outcnt -= cnt;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -543,8 +543,8 @@ rd_wrbuf(char *in, int cpcnt)
|
|||
* do with it
|
||||
*/
|
||||
if ((res = cpcnt - incnt) > 0)
|
||||
return(res);
|
||||
return(cnt);
|
||||
return res;
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -557,7 +557,7 @@ rd_wrbuf(char *in, int cpcnt)
|
|||
incnt -= cnt;
|
||||
in += cnt;
|
||||
}
|
||||
return(cpcnt);
|
||||
return cpcnt;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -582,13 +582,13 @@ wr_skip(off_t skcnt)
|
|||
while (skcnt > 0L) {
|
||||
cnt = bufend - bufpt;
|
||||
if ((cnt <= 0) && ((cnt = buf_flush(blksz)) < 0))
|
||||
return(-1);
|
||||
return -1;
|
||||
cnt = MIN(cnt, skcnt);
|
||||
memset(bufpt, 0, cnt);
|
||||
bufpt += cnt;
|
||||
skcnt -= cnt;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -633,7 +633,7 @@ wr_rdfile(ARCHD *arcn, int ifd, off_t *left)
|
|||
cnt = bufend - bufpt;
|
||||
if ((cnt <= 0) && ((cnt = buf_flush(blksz)) < 0)) {
|
||||
*left = size;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
cnt = MIN(cnt, size);
|
||||
if ((res = read_with_restart(ifd, bufpt, cnt)) <= 0)
|
||||
|
@ -656,7 +656,7 @@ wr_rdfile(ARCHD *arcn, int ifd, off_t *left)
|
|||
tty_warn(1, "File %s was modified during copy to archive",
|
||||
arcn->org_name);
|
||||
*left = size;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -752,7 +752,7 @@ rd_wrfile(ARCHD *arcn, int ofd, off_t *left)
|
|||
* if we failed from archive read, we do not want to skip
|
||||
*/
|
||||
if ((size > 0L) && (*left == 0L))
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* some formats record a crc on file data. If so, then we compare the
|
||||
|
@ -761,7 +761,7 @@ rd_wrfile(ARCHD *arcn, int ofd, off_t *left)
|
|||
if (docrc && (size == 0L) && (arcn->crc != crc))
|
||||
tty_warn(1,"Actual crc does not match expected crc %s",
|
||||
arcn->name);
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -869,7 +869,7 @@ buf_fill(void)
|
|||
static int fini = 0;
|
||||
|
||||
if (fini)
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
for(;;) {
|
||||
/*
|
||||
|
@ -880,7 +880,7 @@ buf_fill(void)
|
|||
bufpt = buf;
|
||||
bufend = buf + cnt;
|
||||
rdcnt += cnt;
|
||||
return(cnt);
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -893,12 +893,12 @@ buf_fill(void)
|
|||
break;
|
||||
if (frmt == NULL || ar_next() < 0) {
|
||||
fini = 1;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
rdcnt = 0;
|
||||
}
|
||||
exit_val = 1;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -929,7 +929,7 @@ buf_flush(int bufcnt)
|
|||
if (ar_next() < 0) {
|
||||
wrcnt = 0;
|
||||
exit_val = 1;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
wrcnt = 0;
|
||||
|
||||
|
@ -944,7 +944,7 @@ buf_flush(int bufcnt)
|
|||
*/
|
||||
bufend = buf + blksz;
|
||||
if (blksz > bufcnt)
|
||||
return(0);
|
||||
return 0;
|
||||
if (blksz < bufcnt)
|
||||
push = bufcnt - blksz;
|
||||
}
|
||||
|
@ -976,7 +976,7 @@ buf_flush(int bufcnt)
|
|||
}
|
||||
} else
|
||||
bufpt = buf;
|
||||
return(totcnt);
|
||||
return totcnt;
|
||||
} else if (cnt > 0) {
|
||||
/*
|
||||
* Oh drat we got a partial write!
|
||||
|
@ -991,7 +991,7 @@ buf_flush(int bufcnt)
|
|||
memcpy(buf, bufpt, cnt);
|
||||
bufpt = buf + cnt;
|
||||
if (!frmt->blkalgn || ((cnt % frmt->blkalgn) == 0))
|
||||
return(totcnt);
|
||||
return totcnt;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1009,7 +1009,7 @@ buf_flush(int bufcnt)
|
|||
*/
|
||||
bufend = buf + blksz;
|
||||
if (blksz > bufcnt)
|
||||
return(0);
|
||||
return 0;
|
||||
if (blksz < bufcnt)
|
||||
push = bufcnt - blksz;
|
||||
}
|
||||
|
@ -1018,5 +1018,5 @@ buf_flush(int bufcnt)
|
|||
* write failed, stop pax. we must not create a bad archive!
|
||||
*/
|
||||
exit_val = 1;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
|
152
bin/pax/cpio.c
152
bin/pax/cpio.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cpio.c,v 1.18 2005/02/04 00:38:15 matt Exp $ */
|
||||
/* $NetBSD: cpio.c,v 1.19 2006/02/11 10:43:18 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
|
@ -42,7 +42,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)cpio.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: cpio.c,v 1.18 2005/02/04 00:38:15 matt Exp $");
|
||||
__RCSID("$NetBSD: cpio.c,v 1.19 2006/02/11 10:43:18 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -83,7 +83,7 @@ int cpio_swp_head; /* binary cpio header byte swap */
|
|||
int
|
||||
cpio_strd(void)
|
||||
{
|
||||
return(lnk_start());
|
||||
return lnk_start();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -103,8 +103,8 @@ cpio_subtrail(ARCHD *arcn)
|
|||
* look for trailer id in file we are about to process
|
||||
*/
|
||||
if ((strcmp(arcn->name, TRAILER) == 0) && (arcn->sb.st_size == 0))
|
||||
return(0);
|
||||
return(-1);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -152,8 +152,8 @@ com_rd(ARCHD *arcn)
|
|||
break;
|
||||
}
|
||||
if (chk_lnk(arcn) < 0)
|
||||
return(-1);
|
||||
return(0);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -176,7 +176,7 @@ cpio_endwr(void)
|
|||
last.type = PAX_REG;
|
||||
last.sb.st_nlink = 1;
|
||||
(void)strcpy(last.name, TRAILER);
|
||||
return((*frmt->wr)(&last));
|
||||
return (*frmt->wr)(&last);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -194,7 +194,7 @@ rd_nm(ARCHD *arcn, int nsz)
|
|||
*/
|
||||
if ((nsz == 0) || (nsz > sizeof(arcn->name))) {
|
||||
tty_warn(1, "Cpio file name length %d is out of range", nsz);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -203,9 +203,9 @@ rd_nm(ARCHD *arcn, int nsz)
|
|||
if ((rd_wrbuf(arcn->name,nsz) != nsz) || (arcn->name[nsz-1] != '\0') ||
|
||||
(arcn->name[0] == '\0')) {
|
||||
tty_warn(1, "Cpio file name in header is corrupted");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -226,7 +226,7 @@ rd_ln_nm(ARCHD *arcn)
|
|||
(arcn->sb.st_size >= sizeof(arcn->ln_name))) {
|
||||
tty_warn(1, "Cpio link name length is invalid: " OFFT_F,
|
||||
(OFFT_T) arcn->sb.st_size);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -235,7 +235,7 @@ rd_ln_nm(ARCHD *arcn)
|
|||
if (rd_wrbuf(arcn->ln_name, (int)arcn->sb.st_size) !=
|
||||
(int)arcn->sb.st_size) {
|
||||
tty_warn(1, "Cpio link name read error");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
arcn->ln_nlen = arcn->sb.st_size;
|
||||
arcn->ln_name[arcn->ln_nlen] = '\0';
|
||||
|
@ -245,9 +245,9 @@ rd_ln_nm(ARCHD *arcn)
|
|||
*/
|
||||
if (arcn->ln_name[0] == '\0') {
|
||||
tty_warn(1, "Cpio link name is corrupt");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -267,8 +267,8 @@ cpio_id(char *blk, int size)
|
|||
{
|
||||
if ((size < sizeof(HD_CPIO)) ||
|
||||
(strncmp(blk, AMAGIC, sizeof(AMAGIC) - 1) != 0))
|
||||
return(-1);
|
||||
return(0);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -289,7 +289,7 @@ cpio_rd(ARCHD *arcn, char *buf)
|
|||
* check that this is a valid header, if not return -1
|
||||
*/
|
||||
if (cpio_id(buf, sizeof(HD_CPIO)) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
hd = (HD_CPIO *)buf;
|
||||
|
||||
/*
|
||||
|
@ -316,10 +316,10 @@ cpio_rd(ARCHD *arcn, char *buf)
|
|||
* follows header in the archive)
|
||||
*/
|
||||
if ((nsz = (int)asc_ul(hd->c_namesize,sizeof(hd->c_namesize),OCT)) < 2)
|
||||
return(-1);
|
||||
return -1;
|
||||
arcn->nlen = nsz - 1;
|
||||
if (rd_nm(arcn, nsz) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
if (((arcn->sb.st_mode&C_IFMT) != C_ISLNK)||(arcn->sb.st_size == 0)) {
|
||||
/*
|
||||
|
@ -327,7 +327,7 @@ cpio_rd(ARCHD *arcn, char *buf)
|
|||
*/
|
||||
arcn->ln_nlen = 0;
|
||||
arcn->ln_name[0] = '\0';
|
||||
return(com_rd(arcn));
|
||||
return com_rd(arcn);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -335,12 +335,12 @@ cpio_rd(ARCHD *arcn, char *buf)
|
|||
* stored like file data.
|
||||
*/
|
||||
if (rd_ln_nm(arcn) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* we have a valid header (with a link)
|
||||
*/
|
||||
return(com_rd(arcn));
|
||||
return com_rd(arcn);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -353,7 +353,7 @@ cpio_rd(ARCHD *arcn, char *buf)
|
|||
off_t
|
||||
cpio_endrd(void)
|
||||
{
|
||||
return((off_t)(sizeof(HD_CPIO) + sizeof(TRAILER)));
|
||||
return (off_t)(sizeof(HD_CPIO) + sizeof(TRAILER));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -366,7 +366,7 @@ cpio_endrd(void)
|
|||
int
|
||||
cpio_stwr(void)
|
||||
{
|
||||
return(dev_start());
|
||||
return dev_start();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -389,7 +389,7 @@ cpio_wr(ARCHD *arcn)
|
|||
* check and repair truncated device and inode fields in the header
|
||||
*/
|
||||
if (map_dev(arcn, (u_long)CPIO_MASK, (u_long)CPIO_MASK) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
arcn->pad = 0L;
|
||||
nsz = arcn->nlen + 1;
|
||||
|
@ -408,7 +408,7 @@ cpio_wr(ARCHD *arcn)
|
|||
sizeof(hd->c_filesize), OCT)) {
|
||||
tty_warn(1,"File is too large for cpio format %s",
|
||||
arcn->org_name);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case PAX_SLK:
|
||||
|
@ -459,7 +459,7 @@ cpio_wr(ARCHD *arcn)
|
|||
(wr_rdbuf(arcn->name, nsz) < 0)) {
|
||||
tty_warn(1, "Unable to write cpio header for %s",
|
||||
arcn->org_name);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -467,9 +467,9 @@ cpio_wr(ARCHD *arcn)
|
|||
* data, if we are link tell caller we are done, go to next file
|
||||
*/
|
||||
if ((arcn->type == PAX_CTG) || (arcn->type == PAX_REG))
|
||||
return(0);
|
||||
return 0;
|
||||
if (arcn->type != PAX_SLK)
|
||||
return(1);
|
||||
return 1;
|
||||
|
||||
/*
|
||||
* write the link name to the archive, tell the caller to go to the
|
||||
|
@ -478,9 +478,9 @@ cpio_wr(ARCHD *arcn)
|
|||
if (wr_rdbuf(arcn->ln_name, arcn->ln_nlen) < 0) {
|
||||
tty_warn(1,"Unable to write cpio link name for %s",
|
||||
arcn->org_name);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(1);
|
||||
return 1;
|
||||
|
||||
out:
|
||||
/*
|
||||
|
@ -488,7 +488,7 @@ cpio_wr(ARCHD *arcn)
|
|||
*/
|
||||
tty_warn(1, "Cpio header field is too small to store file %s",
|
||||
arcn->org_name);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -509,8 +509,8 @@ vcpio_id(char *blk, int size)
|
|||
{
|
||||
if ((size < sizeof(HD_VCPIO)) ||
|
||||
(strncmp(blk, AVMAGIC, sizeof(AVMAGIC) - 1) != 0))
|
||||
return(-1);
|
||||
return(0);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -526,8 +526,8 @@ crc_id(char *blk, int size)
|
|||
{
|
||||
if ((size < sizeof(HD_VCPIO)) ||
|
||||
(strncmp(blk, AVCMAGIC, sizeof(AVCMAGIC) - 1) != 0))
|
||||
return(-1);
|
||||
return(0);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -541,7 +541,7 @@ int
|
|||
crc_strd(void)
|
||||
{
|
||||
docrc = 1;
|
||||
return(lnk_start());
|
||||
return lnk_start();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -566,10 +566,10 @@ vcpio_rd(ARCHD *arcn, char *buf)
|
|||
*/
|
||||
if (docrc) {
|
||||
if (crc_id(buf, sizeof(HD_VCPIO)) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
} else {
|
||||
if (vcpio_id(buf, sizeof(HD_VCPIO)) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
hd = (HD_VCPIO *)buf;
|
||||
|
@ -601,16 +601,16 @@ vcpio_rd(ARCHD *arcn, char *buf)
|
|||
* bogus
|
||||
*/
|
||||
if ((nsz = (int)asc_ul(hd->c_namesize,sizeof(hd->c_namesize),HEX)) < 2)
|
||||
return(-1);
|
||||
return -1;
|
||||
arcn->nlen = nsz - 1;
|
||||
if (rd_nm(arcn, nsz) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* skip padding. header + filename is aligned to 4 byte boundaries
|
||||
*/
|
||||
if (rd_skip((off_t)(VCPIO_PAD(sizeof(HD_VCPIO) + nsz))) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* if not a link (or a file with no data), calculate pad size (for
|
||||
|
@ -623,7 +623,7 @@ vcpio_rd(ARCHD *arcn, char *buf)
|
|||
arcn->ln_nlen = 0;
|
||||
arcn->ln_name[0] = '\0';
|
||||
arcn->pad = VCPIO_PAD(arcn->sb.st_size);
|
||||
return(com_rd(arcn));
|
||||
return com_rd(arcn);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -631,12 +631,12 @@ vcpio_rd(ARCHD *arcn, char *buf)
|
|||
*/
|
||||
if ((rd_ln_nm(arcn) < 0) ||
|
||||
(rd_skip((off_t)(VCPIO_PAD(arcn->sb.st_size))) < 0))
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* we have a valid header (with a link)
|
||||
*/
|
||||
return(com_rd(arcn));
|
||||
return com_rd(arcn);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -649,7 +649,7 @@ vcpio_rd(ARCHD *arcn, char *buf)
|
|||
off_t
|
||||
vcpio_endrd(void)
|
||||
{
|
||||
return((off_t)(sizeof(HD_VCPIO) + sizeof(TRAILER) +
|
||||
return (off_t)(sizeof(HD_VCPIO) + sizeof(TRAILER +
|
||||
(VCPIO_PAD(sizeof(HD_VCPIO) + sizeof(TRAILER)))));
|
||||
}
|
||||
|
||||
|
@ -664,7 +664,7 @@ int
|
|||
crc_stwr(void)
|
||||
{
|
||||
docrc = 1;
|
||||
return(dev_start());
|
||||
return dev_start();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -688,7 +688,7 @@ vcpio_wr(ARCHD *arcn)
|
|||
* header
|
||||
*/
|
||||
if (map_dev(arcn, (u_long)VCPIO_MASK, (u_long)VCPIO_MASK) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
nsz = arcn->nlen + 1;
|
||||
hd = (HD_VCPIO *)hdblk;
|
||||
if ((arcn->type != PAX_BLK) && (arcn->type != PAX_CHR))
|
||||
|
@ -724,7 +724,7 @@ vcpio_wr(ARCHD *arcn)
|
|||
sizeof(hd->c_filesize), HEX)) {
|
||||
tty_warn(1,"File is too large for sv4cpio format %s",
|
||||
arcn->org_name);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case PAX_SLK:
|
||||
|
@ -782,7 +782,7 @@ vcpio_wr(ARCHD *arcn)
|
|||
(wr_skip((off_t)(VCPIO_PAD(sizeof(HD_VCPIO) + nsz))) < 0)) {
|
||||
tty_warn(1,"Could not write sv4cpio header for %s",
|
||||
arcn->org_name);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -790,13 +790,13 @@ vcpio_wr(ARCHD *arcn)
|
|||
*/
|
||||
if ((arcn->type == PAX_CTG) || (arcn->type == PAX_REG) ||
|
||||
(arcn->type == PAX_HRG))
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* if we are not a link, tell the caller we are done, go to next file
|
||||
*/
|
||||
if (arcn->type != PAX_SLK)
|
||||
return(1);
|
||||
return 1;
|
||||
|
||||
/*
|
||||
* write the link name, tell the caller we are done.
|
||||
|
@ -805,9 +805,9 @@ vcpio_wr(ARCHD *arcn)
|
|||
(wr_skip((off_t)(VCPIO_PAD(arcn->ln_nlen))) < 0)) {
|
||||
tty_warn(1,"Could not write sv4cpio link name for %s",
|
||||
arcn->org_name);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(1);
|
||||
return 1;
|
||||
|
||||
out:
|
||||
/*
|
||||
|
@ -815,7 +815,7 @@ vcpio_wr(ARCHD *arcn)
|
|||
*/
|
||||
tty_warn(1,"Sv4cpio header field is too small for file %s",
|
||||
arcn->org_name);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -834,19 +834,19 @@ int
|
|||
bcpio_id(char *blk, int size)
|
||||
{
|
||||
if (size < sizeof(HD_BCPIO))
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* check both normal and byte swapped magic cookies
|
||||
*/
|
||||
if (((u_short)SHRT_EXT(blk)) == MAGIC)
|
||||
return(0);
|
||||
return 0;
|
||||
if (((u_short)RSHRT_EXT(blk)) == MAGIC) {
|
||||
if (!cpio_swp_head)
|
||||
++cpio_swp_head;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -868,7 +868,7 @@ bcpio_rd(ARCHD *arcn, char *buf)
|
|||
* check the header
|
||||
*/
|
||||
if (bcpio_id(buf, sizeof(HD_BCPIO)) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
arcn->pad = 0L;
|
||||
hd = (HD_BCPIO *)buf;
|
||||
|
@ -913,16 +913,16 @@ bcpio_rd(ARCHD *arcn, char *buf)
|
|||
* name
|
||||
*/
|
||||
if (nsz < 2)
|
||||
return(-1);
|
||||
return -1;
|
||||
arcn->nlen = nsz - 1;
|
||||
if (rd_nm(arcn, nsz) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* header + file name are aligned to 2 byte boundaries, skip if needed
|
||||
*/
|
||||
if (rd_skip((off_t)(BCPIO_PAD(sizeof(HD_BCPIO) + nsz))) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* if not a link (or a file with no data), calculate pad size (for
|
||||
|
@ -935,17 +935,17 @@ bcpio_rd(ARCHD *arcn, char *buf)
|
|||
arcn->ln_nlen = 0;
|
||||
arcn->ln_name[0] = '\0';
|
||||
arcn->pad = BCPIO_PAD(arcn->sb.st_size);
|
||||
return(com_rd(arcn));
|
||||
return com_rd(arcn);
|
||||
}
|
||||
|
||||
if ((rd_ln_nm(arcn) < 0) ||
|
||||
(rd_skip((off_t)(BCPIO_PAD(arcn->sb.st_size))) < 0))
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* we have a valid header (with a link)
|
||||
*/
|
||||
return(com_rd(arcn));
|
||||
return com_rd(arcn);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -958,7 +958,7 @@ bcpio_rd(ARCHD *arcn, char *buf)
|
|||
off_t
|
||||
bcpio_endrd(void)
|
||||
{
|
||||
return((off_t)(sizeof(HD_BCPIO) + sizeof(TRAILER) +
|
||||
return (off_t)(sizeof(HD_BCPIO) + sizeof(TRAILER +
|
||||
(BCPIO_PAD(sizeof(HD_BCPIO) + sizeof(TRAILER)))));
|
||||
}
|
||||
|
||||
|
@ -988,7 +988,7 @@ bcpio_wr(ARCHD *arcn)
|
|||
* header
|
||||
*/
|
||||
if (map_dev(arcn, (u_long)BCPIO_MASK, (u_long)BCPIO_MASK) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
if ((arcn->type != PAX_BLK) && (arcn->type != PAX_CHR))
|
||||
arcn->sb.st_rdev = 0;
|
||||
|
@ -1012,7 +1012,7 @@ bcpio_wr(ARCHD *arcn)
|
|||
if (arcn->sb.st_size != t_offt) {
|
||||
tty_warn(1,"File is too large for bcpio format %s",
|
||||
arcn->org_name);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case PAX_SLK:
|
||||
|
@ -1097,7 +1097,7 @@ bcpio_wr(ARCHD *arcn)
|
|||
(wr_skip((off_t)(BCPIO_PAD(sizeof(HD_BCPIO) + nsz))) < 0)) {
|
||||
tty_warn(1, "Could not write bcpio header for %s",
|
||||
arcn->org_name);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1105,13 +1105,13 @@ bcpio_wr(ARCHD *arcn)
|
|||
*/
|
||||
if ((arcn->type == PAX_CTG) || (arcn->type == PAX_REG) ||
|
||||
(arcn->type == PAX_HRG))
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* if we are not a link, tell the caller we are done, go to next file
|
||||
*/
|
||||
if (arcn->type != PAX_SLK)
|
||||
return(1);
|
||||
return 1;
|
||||
|
||||
/*
|
||||
* write the link name, tell the caller we are done.
|
||||
|
@ -1120,9 +1120,9 @@ bcpio_wr(ARCHD *arcn)
|
|||
(wr_skip((off_t)(BCPIO_PAD(arcn->ln_nlen))) < 0)) {
|
||||
tty_warn(1,"Could not write bcpio link name for %s",
|
||||
arcn->org_name);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(1);
|
||||
return 1;
|
||||
|
||||
out:
|
||||
/*
|
||||
|
@ -1130,5 +1130,5 @@ bcpio_wr(ARCHD *arcn)
|
|||
*/
|
||||
tty_warn(1,"Bcpio header field is too small for file %s",
|
||||
arcn->org_name);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: file_subs.c,v 1.58 2006/01/04 22:02:11 yamt Exp $ */
|
||||
/* $NetBSD: file_subs.c,v 1.59 2006/02/11 10:43:18 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
|
@ -42,7 +42,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)file_subs.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: file_subs.c,v 1.58 2006/01/04 22:02:11 yamt Exp $");
|
||||
__RCSID("$NetBSD: file_subs.c,v 1.59 2006/02/11 10:43:18 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -147,7 +147,7 @@ file_creat(ARCHD *arcn, int write_to_hardlink)
|
|||
arcn->tmp_name = malloc(arcn->nlen + 8);
|
||||
if (arcn->tmp_name == NULL) {
|
||||
syswarn(1, errno, "Cannot malloc %d bytes", arcn->nlen + 8);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
if (xtmp_name != NULL)
|
||||
abort();
|
||||
|
@ -172,10 +172,10 @@ file_creat(ARCHD *arcn, int write_to_hardlink)
|
|||
xtmp_name = NULL;
|
||||
free(arcn->tmp_name);
|
||||
arcn->tmp_name = NULL;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return(fd);
|
||||
return fd;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -279,16 +279,16 @@ lnk_creat(ARCHD *arcn, int *payload)
|
|||
if (lstat(arcn->ln_name, &sb) < 0) {
|
||||
syswarn(1, errno, "Cannot link to %s from %s", arcn->ln_name,
|
||||
arcn->name);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (S_ISDIR(sb.st_mode)) {
|
||||
tty_warn(1, "A hard link to the directory %s is not allowed",
|
||||
arcn->ln_name);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return(mk_link(arcn->ln_name, &sb, arcn->name, 0));
|
||||
return mk_link(arcn->ln_name, &sb, arcn->name, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -310,8 +310,8 @@ cross_lnk(ARCHD *arcn)
|
|||
* root (and it might succeed).
|
||||
*/
|
||||
if (arcn->type == PAX_DIR)
|
||||
return(1);
|
||||
return(mk_link(arcn->org_name, &(arcn->sb), arcn->name, 1));
|
||||
return 1;
|
||||
return mk_link(arcn->org_name, &(arcn->sb), arcn->name, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -335,9 +335,9 @@ chk_same(ARCHD *arcn)
|
|||
* quietly
|
||||
*/
|
||||
if (lstat(arcn->name, &sb) < 0)
|
||||
return(1);
|
||||
return 1;
|
||||
if (kflag)
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* better make sure the user does not have src == dest by mistake
|
||||
|
@ -345,9 +345,9 @@ chk_same(ARCHD *arcn)
|
|||
if ((arcn->sb.st_dev == sb.st_dev) && (arcn->sb.st_ino == sb.st_ino)) {
|
||||
tty_warn(1, "Unable to copy %s, file would overwrite itself",
|
||||
arcn->name);
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -374,14 +374,14 @@ mk_link(char *to, struct stat *to_sb, char *from, int ign)
|
|||
*/
|
||||
if (lstat(from, &sb) == 0) {
|
||||
if (kflag)
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* make sure it is not the same file, protect the user
|
||||
*/
|
||||
if ((to_sb->st_dev==sb.st_dev)&&(to_sb->st_ino == sb.st_ino)) {
|
||||
tty_warn(1, "Cannot link file %s to itself", to);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -390,14 +390,14 @@ mk_link(char *to, struct stat *to_sb, char *from, int ign)
|
|||
if (S_ISDIR(sb.st_mode) && strcmp(from, ".") != 0) {
|
||||
if (rmdir(from) < 0) {
|
||||
syswarn(1, errno, "Cannot remove %s", from);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
} else if (unlink(from) < 0) {
|
||||
if (!ign) {
|
||||
syswarn(1, errno, "Cannot remove %s", from);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -415,15 +415,15 @@ mk_link(char *to, struct stat *to_sb, char *from, int ign)
|
|||
if (!ign) {
|
||||
syswarn(1, oerrno, "Cannot link to %s from %s", to,
|
||||
from);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* all right the link was made
|
||||
*/
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -622,7 +622,7 @@ badlink:
|
|||
if (pfflags && arcn->type != PAX_SLK)
|
||||
set_chflags(arcn->name, arcn->sb.st_flags);
|
||||
#endif
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -646,9 +646,9 @@ unlnk_exist(char *name, int type)
|
|||
* the file does not exist, or -k we are done
|
||||
*/
|
||||
if (lstat(name, &sb) < 0)
|
||||
return(0);
|
||||
return 0;
|
||||
if (kflag)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
if (S_ISDIR(sb.st_mode)) {
|
||||
/*
|
||||
|
@ -659,14 +659,14 @@ unlnk_exist(char *name, int type)
|
|||
* otherwise later file/directory creation fails.
|
||||
*/
|
||||
if (strcmp(name, ".") == 0)
|
||||
return(1);
|
||||
return 1;
|
||||
if (rmdir(name) < 0) {
|
||||
if (type == PAX_DIR)
|
||||
return(1);
|
||||
return 1;
|
||||
syswarn(1, errno, "Cannot remove directory %s", name);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -675,9 +675,9 @@ unlnk_exist(char *name, int type)
|
|||
if (unlink(name) < 0) {
|
||||
(void)fflush(listf);
|
||||
syswarn(1, errno, "Cannot unlink %s", name);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -846,9 +846,9 @@ set_ids(char *fnm, uid_t uid, gid_t gid)
|
|||
(void)fflush(listf);
|
||||
syswarn(1, errno, "Cannot set file uid/gid of %s",
|
||||
fnm);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -984,7 +984,7 @@ file_write(int fd, char *str, int cnt, int *rem, int *isempt, int sz,
|
|||
lseek(fd, (off_t)wcnt, SEEK_CUR) < 0) {
|
||||
syswarn(1, errno, "File seek on %s",
|
||||
name);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
st = pt;
|
||||
continue;
|
||||
|
@ -1017,18 +1017,18 @@ file_write(int fd, char *str, int cnt, int *rem, int *isempt, int sz,
|
|||
malloc(wcnt + 1);
|
||||
if (nstr == NULL) {
|
||||
tty_warn(1, "Out of memory");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
(void)strlcpy(&nstr[*lenp], st, wcnt + 1);
|
||||
*strp = nstr;
|
||||
*lenp += wcnt;
|
||||
} else if (xwrite(fd, st, wcnt) != wcnt) {
|
||||
syswarn(1, errno, "Failed write to file %s", name);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
st += wcnt;
|
||||
}
|
||||
return(st - str);
|
||||
return st - str;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1115,7 +1115,7 @@ set_crc(ARCHD *arcn, int fd)
|
|||
* hmm, no fd, should never happen. well no crc then.
|
||||
*/
|
||||
arcn->crc = 0L;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((size = (u_long)arcn->sb.st_blksize) > (u_long)sizeof(tbuf))
|
||||
|
@ -1147,7 +1147,7 @@ set_crc(ARCHD *arcn, int fd)
|
|||
syswarn(1, errno, "File rewind failed on: %s", arcn->org_name);
|
||||
else {
|
||||
arcn->crc = crc;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ftree.c,v 1.33 2005/09/24 17:05:21 dsl Exp $ */
|
||||
/* $NetBSD: ftree.c,v 1.34 2006/02/11 10:43:18 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
|
@ -78,7 +78,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)ftree.c 8.2 (Berkeley) 4/18/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: ftree.c,v 1.33 2005/09/24 17:05:21 dsl Exp $");
|
||||
__RCSID("$NetBSD: ftree.c,v 1.34 2006/02/11 10:43:18 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -159,16 +159,16 @@ ftree_start()
|
|||
if (fthead != NULL) {
|
||||
tty_warn(1,
|
||||
"The -M flag is only supported when reading file list from stdin");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
ftnode = spec(stdin);
|
||||
if (ftnode != NULL &&
|
||||
(ftnode->type != F_DIR || strcmp(ftnode->name, ".") != 0)) {
|
||||
tty_warn(1,
|
||||
"First node of specfile is not `.' directory");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
#endif /* SMALL */
|
||||
|
||||
|
@ -205,14 +205,14 @@ ftree_start()
|
|||
|
||||
if ((fthead == NULL) && ((farray[0] = malloc(PAXPATHLEN+2)) == NULL)) {
|
||||
tty_warn(1, "Unable to allocate memory for file name buffer");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ftree_arg() < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
if (tflag && (atdir_start() < 0))
|
||||
return(-1);
|
||||
return(0);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -234,7 +234,7 @@ ftree_add(char *str, int isdir)
|
|||
*/
|
||||
if ((str == NULL) || (*str == '\0')) {
|
||||
tty_warn(0, "Invalid file name argument");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -244,7 +244,7 @@ ftree_add(char *str, int isdir)
|
|||
*/
|
||||
if ((ft = (FTREE *)malloc(sizeof(FTREE))) == NULL) {
|
||||
tty_warn(0, "Unable to allocate memory for filename");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (((len = strlen(str) - 1) > 0) && (str[len] == '/'))
|
||||
|
@ -254,11 +254,11 @@ ftree_add(char *str, int isdir)
|
|||
ft->fow = NULL;
|
||||
if (fthead == NULL) {
|
||||
fttail = fthead = ft;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
fttail->fow = ft;
|
||||
fttail = ft;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -381,7 +381,7 @@ ftree_arg(void)
|
|||
if (ftcur == NULL)
|
||||
ftcur = fthead;
|
||||
else if ((ftcur = ftcur->fow) == NULL)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
if (ftcur->refcnt < 0) {
|
||||
/*
|
||||
|
@ -407,7 +407,7 @@ ftree_arg(void)
|
|||
if ((ftsp = fts_open(farray, ftsopts, NULL)) != NULL)
|
||||
break;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -476,7 +476,7 @@ next_file(ARCHD *arcn)
|
|||
tty_warn(1, "line %lu: %s: %s not specified", \
|
||||
(u_long)ftnode->lineno, \
|
||||
ftent->fts_path, m); \
|
||||
return(-1); \
|
||||
return -1; \
|
||||
}
|
||||
statbuf.st_mode = nodetoino(ftnode->type);
|
||||
NODETEST(ftnode->flags & F_TYPE, "type");
|
||||
|
@ -500,7 +500,7 @@ next_file(ARCHD *arcn)
|
|||
(u_long)ftnode->lineno, ftent->fts_path,
|
||||
inotype(nodetoino(ftnode->type)),
|
||||
inotype(statbuf.st_mode));
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
if (ftnode->type == F_DIR && (ftnode->flags & F_OPT))
|
||||
skipoptional = 1;
|
||||
|
@ -578,7 +578,7 @@ next_file(ARCHD *arcn)
|
|||
*/
|
||||
ftree_skip = 0;
|
||||
if (ftree_arg() < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ftsp == NULL)
|
||||
|
@ -593,7 +593,7 @@ next_file(ARCHD *arcn)
|
|||
* we are done
|
||||
*/
|
||||
if (ftree_arg() < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -759,5 +759,5 @@ next_file(ARCHD *arcn)
|
|||
ftcur->refcnt = 1;
|
||||
(void)ftree_arg();
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: gen_subs.c,v 1.32 2003/10/27 00:12:41 lukem Exp $ */
|
||||
/* $NetBSD: gen_subs.c,v 1.33 2006/02/11 10:43:18 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
|
@ -42,7 +42,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)gen_subs.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: gen_subs.c,v 1.32 2003/10/27 00:12:41 lukem Exp $");
|
||||
__RCSID("$NetBSD: gen_subs.c,v 1.33 2006/02/11 10:43:18 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -242,7 +242,7 @@ asc_ul(char *str, int len, int base)
|
|||
while ((str < stop) && (*str >= '0') && (*str <= '7'))
|
||||
tval = (tval << 3) + (*str++ - '0');
|
||||
}
|
||||
return(tval);
|
||||
return tval;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -291,8 +291,8 @@ ul_asc(u_long val, char *str, int len, int base)
|
|||
while (pt >= str)
|
||||
*pt-- = '0';
|
||||
if (val != (u_long)0)
|
||||
return(-1);
|
||||
return(0);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(NET2_STAT) && !defined(_LP64)
|
||||
|
@ -339,7 +339,7 @@ asc_ull(char *str, int len, int base)
|
|||
while ((str < stop) && (*str >= '0') && (*str <= '7'))
|
||||
tval = (tval << 3) + (*str++ - '0');
|
||||
}
|
||||
return(tval);
|
||||
return tval;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -388,8 +388,8 @@ ull_asc(unsigned long long val, char *str, int len, int base)
|
|||
while (pt >= str)
|
||||
*pt-- = '0';
|
||||
if (val != (unsigned long long)0)
|
||||
return(-1);
|
||||
return(0);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: getoldopt.c,v 1.21 2005/06/05 19:08:28 chs Exp $ */
|
||||
/* $NetBSD: getoldopt.c,v 1.22 2006/02/11 10:43:18 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Plug-compatible replacement for getopt() for parsing tar-like
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(lint)
|
||||
__RCSID("$NetBSD: getoldopt.c,v 1.21 2005/06/05 19:08:28 chs Exp $");
|
||||
__RCSID("$NetBSD: getoldopt.c,v 1.22 2006/02/11 10:43:18 dsl Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#if HAVE_NBTOOL_CONFIG_H
|
||||
|
@ -72,7 +72,7 @@ getoldopt(int argc, char **argv, const char *optstring,
|
|||
|
||||
if (place == NULL || c == ':') {
|
||||
fprintf(stderr, "%s: unknown option %c\n", argv[0], c);
|
||||
return('?');
|
||||
return '?';
|
||||
}
|
||||
|
||||
place++;
|
||||
|
@ -83,9 +83,9 @@ getoldopt(int argc, char **argv, const char *optstring,
|
|||
} else {
|
||||
fprintf(stderr, "%s: %c argument missing\n",
|
||||
argv[0], c);
|
||||
return('?');
|
||||
return '?';
|
||||
}
|
||||
}
|
||||
|
||||
return(c);
|
||||
return c;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: options.c,v 1.92 2005/09/16 16:48:18 christos Exp $ */
|
||||
/* $NetBSD: options.c,v 1.93 2006/02/11 10:43:18 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
|
@ -42,7 +42,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: options.c,v 1.92 2005/09/16 16:48:18 christos Exp $");
|
||||
__RCSID("$NetBSD: options.c,v 1.93 2006/02/11 10:43:18 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -1778,7 +1778,7 @@ printflg(unsigned int flg)
|
|||
static int
|
||||
c_frmt(const void *a, const void *b)
|
||||
{
|
||||
return(strcmp(((const FSUB *)a)->name, ((const FSUB *)b)->name));
|
||||
return strcmp(((const FSUB *)a)->name, ((const FSUB *)b)->name);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1796,7 +1796,7 @@ opt_next(void)
|
|||
|
||||
if ((opt = ophead) != NULL)
|
||||
ophead = ophead->fow;
|
||||
return(opt);
|
||||
return opt;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1811,7 +1811,7 @@ bad_opt(void)
|
|||
OPLIST *opt;
|
||||
|
||||
if (ophead == NULL)
|
||||
return(0);
|
||||
return 0;
|
||||
/*
|
||||
* print all we were given
|
||||
*/
|
||||
|
@ -1827,7 +1827,7 @@ bad_opt(void)
|
|||
#endif
|
||||
else
|
||||
pax_usage();
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1850,11 +1850,11 @@ opt_add(const char *str)
|
|||
|
||||
if ((str == NULL) || (*str == '\0')) {
|
||||
tty_warn(0, "Invalid option name");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
if ((dstr = strdup(str)) == NULL) {
|
||||
tty_warn(0, "Unable to allocate space for option list");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
frpt = endpt = dstr;
|
||||
|
||||
|
@ -1869,12 +1869,12 @@ opt_add(const char *str)
|
|||
if ((pt = strchr(frpt, '=')) == NULL) {
|
||||
tty_warn(0, "Invalid options format");
|
||||
free(dstr);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
if ((opt = (OPLIST *)malloc(sizeof(OPLIST))) == NULL) {
|
||||
tty_warn(0, "Unable to allocate space for option list");
|
||||
free(dstr);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
*pt++ = '\0';
|
||||
opt->name = frpt;
|
||||
|
@ -1891,7 +1891,7 @@ opt_add(const char *str)
|
|||
optail->fow = opt;
|
||||
optail = opt;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1917,35 +1917,35 @@ str_offt(char *val)
|
|||
|
||||
num = STRTOOFFT(val, &expr, 0);
|
||||
if ((num == OFFT_MAX) || (num <= 0) || (expr == val))
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
switch(*expr) {
|
||||
case 'b':
|
||||
t = num;
|
||||
num *= 512;
|
||||
if (t > num)
|
||||
return(0);
|
||||
return 0;
|
||||
++expr;
|
||||
break;
|
||||
case 'k':
|
||||
t = num;
|
||||
num *= 1024;
|
||||
if (t > num)
|
||||
return(0);
|
||||
return 0;
|
||||
++expr;
|
||||
break;
|
||||
case 'm':
|
||||
t = num;
|
||||
num *= 1048576;
|
||||
if (t > num)
|
||||
return(0);
|
||||
return 0;
|
||||
++expr;
|
||||
break;
|
||||
case 'w':
|
||||
t = num;
|
||||
num *= sizeof(int);
|
||||
if (t > num)
|
||||
return(0);
|
||||
return 0;
|
||||
++expr;
|
||||
break;
|
||||
}
|
||||
|
@ -1958,12 +1958,12 @@ str_offt(char *val)
|
|||
t = num;
|
||||
num *= str_offt(expr + 1);
|
||||
if (t > num)
|
||||
return(0);
|
||||
return 0;
|
||||
break;
|
||||
default:
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
return(num);
|
||||
return num;
|
||||
}
|
||||
|
||||
char *
|
||||
|
@ -1975,18 +1975,18 @@ getline(FILE *f)
|
|||
name = fgetln(f, &len);
|
||||
if (!name) {
|
||||
getline_error = ferror(f) ? GETLINE_FILE_CORRUPT : 0;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
if (name[len-1] != '\n')
|
||||
len++;
|
||||
temp = malloc(len);
|
||||
if (!temp) {
|
||||
getline_error = GETLINE_OUT_OF_MEM;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
memcpy(temp, name, len-1);
|
||||
temp[len-1] = 0;
|
||||
return(temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1999,7 +1999,7 @@ getline(FILE *f)
|
|||
static int
|
||||
no_op(void)
|
||||
{
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pat_rep.c,v 1.23 2005/01/23 06:19:03 jmc Exp $ */
|
||||
/* $NetBSD: pat_rep.c,v 1.24 2006/02/11 10:43:18 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
|
@ -42,7 +42,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)pat_rep.c 8.2 (Berkeley) 4/18/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: pat_rep.c,v 1.23 2005/01/23 06:19:03 jmc Exp $");
|
||||
__RCSID("$NetBSD: pat_rep.c,v 1.24 2006/02/11 10:43:18 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -123,7 +123,7 @@ rep_add(char *str)
|
|||
*/
|
||||
if ((str == NULL) || (*str == '\0')) {
|
||||
tty_warn(1, "Empty replacement string");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -140,7 +140,7 @@ rep_add(char *str)
|
|||
}
|
||||
if (*pt1 == 0) {
|
||||
tty_warn(1, "Invalid replacement string %s", str);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -149,7 +149,7 @@ rep_add(char *str)
|
|||
*/
|
||||
if ((rep = (REPLACE *)malloc(sizeof(REPLACE))) == NULL) {
|
||||
tty_warn(1, "Unable to allocate memory for replacement string");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
*pt1 = '\0';
|
||||
|
@ -162,7 +162,7 @@ rep_add(char *str)
|
|||
tty_warn(1, "%s while compiling regular expression %s", rebuf,
|
||||
str);
|
||||
(void)free((char *)rep);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -187,7 +187,7 @@ rep_add(char *str)
|
|||
#endif
|
||||
(void)free((char *)rep);
|
||||
tty_warn(1, "Invalid replacement string %s", str);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
*pt2 = '\0';
|
||||
|
@ -201,7 +201,7 @@ rep_add(char *str)
|
|||
#endif
|
||||
(void)free((char *)rep);
|
||||
tty_warn(1, "Unable to allocate memory for replacement string");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pt1 = pt2++;
|
||||
|
@ -230,7 +230,7 @@ rep_add(char *str)
|
|||
*pt1 = *str;
|
||||
tty_warn(1, "Invalid replacement string option %s",
|
||||
str);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
++pt2;
|
||||
}
|
||||
|
@ -241,11 +241,11 @@ rep_add(char *str)
|
|||
rep->fow = NULL;
|
||||
if (rephead == NULL) {
|
||||
reptail = rephead = rep;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
reptail->fow = rep;
|
||||
reptail = rep;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -270,7 +270,7 @@ pat_add(char *str, char *chdn)
|
|||
*/
|
||||
if ((str == NULL) || (*str == '\0')) {
|
||||
tty_warn(1, "Empty pattern string");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -280,7 +280,7 @@ pat_add(char *str, char *chdn)
|
|||
*/
|
||||
if ((pt = (PATTERN *)malloc(sizeof(PATTERN))) == NULL) {
|
||||
tty_warn(1, "Unable to allocate memory for pattern string");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pt->pstr = str;
|
||||
|
@ -291,11 +291,11 @@ pat_add(char *str, char *chdn)
|
|||
pt->chdname = chdn;
|
||||
if (pathead == NULL) {
|
||||
pattail = pathead = pt;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
pattail->fow = pt;
|
||||
pattail = pt;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -352,7 +352,7 @@ pat_sel(ARCHD *arcn)
|
|||
* if no patterns just return
|
||||
*/
|
||||
if ((pathead == NULL) || ((pt = arcn->pat) == NULL))
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* when we are NOT limited to a single match per pattern mark the
|
||||
|
@ -360,7 +360,7 @@ pat_sel(ARCHD *arcn)
|
|||
*/
|
||||
if (!nflag) {
|
||||
pt->flgs |= MTCH;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -371,7 +371,7 @@ pat_sel(ARCHD *arcn)
|
|||
* with -d, this pattern was already selected and we are done
|
||||
*/
|
||||
if (pt->flgs & DIR_MTCH)
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
if (!dflag && ((pt->pend != NULL) || (arcn->type == PAX_DIR))) {
|
||||
/*
|
||||
|
@ -395,7 +395,7 @@ pat_sel(ARCHD *arcn)
|
|||
if (pt->pend != NULL)
|
||||
*pt->pend = '/';
|
||||
pt->pend = NULL;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -417,7 +417,7 @@ pat_sel(ARCHD *arcn)
|
|||
}
|
||||
pt->flgs = DIR_MTCH | MTCH;
|
||||
arcn->pat = pt;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -440,12 +440,12 @@ pat_sel(ARCHD *arcn)
|
|||
* should never happen....
|
||||
*/
|
||||
tty_warn(1, "Pattern list inconsistant");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
*ppt = pt->fow;
|
||||
(void)free((char *)pt);
|
||||
arcn->pat = NULL;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -473,8 +473,8 @@ pat_match(ARCHD *arcn)
|
|||
*/
|
||||
if (pathead == NULL) {
|
||||
if (nflag && !cflag)
|
||||
return(-1);
|
||||
return(0);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -506,7 +506,7 @@ pat_match(ARCHD *arcn)
|
|||
* match
|
||||
*/
|
||||
if (pt == NULL)
|
||||
return(cflag ? 0 : 1);
|
||||
return cflag ? 0 : 1;
|
||||
|
||||
/*
|
||||
* we had a match, now when we invert the sense (-c) we reject this
|
||||
|
@ -515,12 +515,12 @@ pat_match(ARCHD *arcn)
|
|||
*/
|
||||
arcn->pat = pt;
|
||||
if (!cflag)
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
if (pat_sel(arcn) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
arcn->pat = NULL;
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -546,20 +546,20 @@ fn_match(char *pattern, char *string, char **pend)
|
|||
* Ok we found an exact match
|
||||
*/
|
||||
if (*string == '\0')
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Check if it is a prefix match
|
||||
*/
|
||||
if ((dflag == 1) || (*string != '/'))
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* It is a prefix match, remember where the trailing
|
||||
* / is located
|
||||
*/
|
||||
*pend = string;
|
||||
return(0);
|
||||
return 0;
|
||||
case '?':
|
||||
if ((test = *string++) == '\0')
|
||||
return (-1);
|
||||
|
@ -694,13 +694,13 @@ mod_name(ARCHD *arcn)
|
|||
*/
|
||||
if ((res = rep_name(arcn->name, sizeof(arcn->name),
|
||||
&(arcn->nlen), 1)) != 0)
|
||||
return(res);
|
||||
return res;
|
||||
|
||||
if (((arcn->type == PAX_SLK) || (arcn->type == PAX_HLK) ||
|
||||
(arcn->type == PAX_HRG)) &&
|
||||
((res = rep_name(arcn->ln_name, sizeof(arcn->ln_name),
|
||||
&(arcn->ln_nlen), 0)) != 0))
|
||||
return(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
if (iflag) {
|
||||
|
@ -708,7 +708,7 @@ mod_name(ARCHD *arcn)
|
|||
* perform interactive file rename, then map the link if any
|
||||
*/
|
||||
if ((res = tty_rename(arcn)) != 0)
|
||||
return(res);
|
||||
return res;
|
||||
if ((arcn->type == PAX_SLK) || (arcn->type == PAX_HLK) ||
|
||||
(arcn->type == PAX_HRG))
|
||||
sub_name(arcn->ln_name, &(arcn->ln_nlen), sizeof(arcn->ln_name));
|
||||
|
@ -746,7 +746,7 @@ mod_name(ARCHD *arcn)
|
|||
}
|
||||
}
|
||||
|
||||
return(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -779,7 +779,7 @@ tty_rename(ARCHD *arcn)
|
|||
tty_prnt("or a \"return\" to skip this file.\n");
|
||||
tty_prnt("Input > ");
|
||||
if (tty_read(tmpname, sizeof(tmpname)) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
if (strcmp(tmpname, "..") == 0) {
|
||||
tty_prnt("Try again, illegal file name: ..\n");
|
||||
continue;
|
||||
|
@ -796,11 +796,11 @@ tty_rename(ARCHD *arcn)
|
|||
*/
|
||||
if (tmpname[0] == '\0') {
|
||||
tty_prnt("Skipping file.\n");
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
if ((tmpname[0] == '.') && (tmpname[1] == '\0')) {
|
||||
tty_prnt("Processing continues, name unchanged.\n");
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -812,8 +812,8 @@ tty_rename(ARCHD *arcn)
|
|||
res = add_name(arcn->name, arcn->nlen, tmpname);
|
||||
arcn->nlen = strlcpy(arcn->name, tmpname, sizeof(arcn->name));
|
||||
if (res < 0)
|
||||
return(-1);
|
||||
return(0);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -828,7 +828,7 @@ int
|
|||
set_dest(ARCHD *arcn, char *dest_dir, int dir_len)
|
||||
{
|
||||
if (fix_path(arcn->name, &(arcn->nlen), dest_dir, dir_len) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* It is really hard to deal with symlinks here, we cannot be sure
|
||||
|
@ -836,11 +836,11 @@ set_dest(ARCHD *arcn, char *dest_dir, int dir_len)
|
|||
* leave them alone.
|
||||
*/
|
||||
if ((arcn->type != PAX_HLK) && (arcn->type != PAX_HRG))
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
if (fix_path(arcn->ln_name, &(arcn->ln_nlen), dest_dir, dir_len) < 0)
|
||||
return(-1);
|
||||
return(0);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -874,7 +874,7 @@ fix_path( char *or_name, int *or_len, char *dir_name, int dir_len)
|
|||
}
|
||||
if ((len = dest - or_name) > PAXPATHLEN) {
|
||||
tty_warn(1, "File name %s/%s, too long", dir_name, start);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
*or_len = len;
|
||||
|
||||
|
@ -892,7 +892,7 @@ fix_path( char *or_name, int *or_len, char *dir_name, int dir_len)
|
|||
*dest-- = *src--;
|
||||
|
||||
*(or_name + len) = '\0';
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -996,7 +996,7 @@ rep_name(char *name, size_t namelen, int *nlen, int prnt)
|
|||
if (prnt)
|
||||
tty_warn(1, "Replacement name error %s",
|
||||
name);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
outpt += res;
|
||||
|
||||
|
@ -1047,7 +1047,7 @@ rep_name(char *name, size_t namelen, int *nlen, int prnt)
|
|||
if (prnt)
|
||||
tty_warn(1,"Replacement name too long %s >> %s",
|
||||
name, nname);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1066,10 +1066,10 @@ rep_name(char *name, size_t namelen, int *nlen, int prnt)
|
|||
* otherwise copy the new name over the orig name and return
|
||||
*/
|
||||
if (*nname == '\0')
|
||||
return(1);
|
||||
return 1;
|
||||
*nlen = strlcpy(name, nname, namelen);
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1145,7 +1145,7 @@ resub(regexp *prog, char *src, char *dest, char *destend)
|
|||
strncpy(dpt, prog->startp[no], len);
|
||||
dpt += len;
|
||||
}
|
||||
return(dpt - dest);
|
||||
return dpt - dest;
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -1184,7 +1184,7 @@ resub(regex_t *rp, regmatch_t *pm, char *src, char *txt, char *dest,
|
|||
* make sure there is a subexpression as specified
|
||||
*/
|
||||
if ((len = *spt++ - '0') > subexcnt)
|
||||
return(-1);
|
||||
return -1;
|
||||
pmpt = pm + len;
|
||||
} else {
|
||||
/*
|
||||
|
@ -1212,6 +1212,6 @@ resub(regex_t *rp, regmatch_t *pm, char *src, char *txt, char *dest,
|
|||
strncpy(dpt, txt + pmpt->rm_so, len);
|
||||
dpt += len;
|
||||
}
|
||||
return(dpt - dest);
|
||||
return dpt - dest;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pax.c,v 1.38 2006/02/11 10:35:19 dsl Exp $ */
|
||||
/* $NetBSD: pax.c,v 1.39 2006/02/11 10:43:18 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
|
@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)pax.c 8.2 (Berkeley) 4/18/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: pax.c,v 1.38 2006/02/11 10:35:19 dsl Exp $");
|
||||
__RCSID("$NetBSD: pax.c,v 1.39 2006/02/11 10:43:18 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -256,7 +256,7 @@ main(int argc, char **argv)
|
|||
* general init
|
||||
*/
|
||||
if ((gen_init() < 0) || (tty_init() < 0))
|
||||
return(exit_val);
|
||||
return exit_val;
|
||||
|
||||
/*
|
||||
* Keep a reference to cwd, so we can always come back home.
|
||||
|
@ -264,10 +264,10 @@ main(int argc, char **argv)
|
|||
cwdfd = open(".", O_RDONLY);
|
||||
if (cwdfd < 0) {
|
||||
syswarn(1, errno, "Can't open current working directory.");
|
||||
return(exit_val);
|
||||
return exit_val;
|
||||
}
|
||||
if (updatepath() == -1)
|
||||
return(exit_val);
|
||||
return exit_val;
|
||||
|
||||
/*
|
||||
* Where should we put temporary files?
|
||||
|
@ -280,7 +280,7 @@ main(int argc, char **argv)
|
|||
tempfile = malloc(tdlen + 1 + sizeof(_TFILE_BASE));
|
||||
if (tempfile == NULL) {
|
||||
tty_warn(1, "Cannot allocate memory for temp file name.");
|
||||
return(exit_val);
|
||||
return exit_val;
|
||||
}
|
||||
if (tdlen)
|
||||
memcpy(tempfile, tmpdir, tdlen);
|
||||
|
@ -322,7 +322,7 @@ main(int argc, char **argv)
|
|||
list();
|
||||
break;
|
||||
}
|
||||
return(exit_val);
|
||||
return exit_val;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -426,18 +426,18 @@ gen_init(void)
|
|||
(sigaddset(&s_mask,SIGINT) < 0)||(sigaddset(&s_mask,SIGHUP) < 0) ||
|
||||
(sigaddset(&s_mask,SIGPIPE) < 0)||(sigaddset(&s_mask,SIGQUIT)<0)){
|
||||
tty_warn(1, "Unable to set up signal mask");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
#ifdef SIGXCPU
|
||||
if (sigaddset(&s_mask,SIGXCPU) < 0) {
|
||||
tty_warn(1, "Unable to set up signal mask");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
#ifdef SIGXFSZ
|
||||
if (sigaddset(&s_mask,SIGXFSZ) < 0) {
|
||||
tty_warn(1, "Unable to set up signal mask");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -479,9 +479,9 @@ gen_init(void)
|
|||
if (sigaction(SIGXFSZ, &n_hand, &o_hand) < 0)
|
||||
goto out;
|
||||
#endif
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
out:
|
||||
syswarn(1, errno, "Unable to set up signal handler");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sel_subs.c,v 1.19 2003/10/27 00:12:41 lukem Exp $ */
|
||||
/* $NetBSD: sel_subs.c,v 1.20 2006/02/11 10:43:18 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
|
@ -42,7 +42,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)sel_subs.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: sel_subs.c,v 1.19 2003/10/27 00:12:41 lukem Exp $");
|
||||
__RCSID("$NetBSD: sel_subs.c,v 1.20 2006/02/11 10:43:18 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -93,8 +93,8 @@ sel_chk(ARCHD *arcn)
|
|||
if (((usrtb != NULL) && usr_match(arcn)) ||
|
||||
((grptb != NULL) && grp_match(arcn)) ||
|
||||
((trhead != NULL) && trng_match(arcn)))
|
||||
return(1);
|
||||
return(0);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -124,12 +124,12 @@ usr_add(char *str)
|
|||
* create the table if it doesn't exist
|
||||
*/
|
||||
if ((str == NULL) || (*str == '\0'))
|
||||
return(-1);
|
||||
return -1;
|
||||
if ((usrtb == NULL) &&
|
||||
((usrtb = (USRT **)calloc(USR_TB_SZ, sizeof(USRT *))) == NULL)) {
|
||||
tty_warn(1,
|
||||
"Unable to allocate memory for user selection table");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -143,7 +143,7 @@ usr_add(char *str)
|
|||
++str;
|
||||
if ((pw = getpwnam(str)) == NULL) {
|
||||
tty_warn(1, "Unable to find uid for user: %s", str);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
uid = (uid_t)pw->pw_uid;
|
||||
} else
|
||||
|
@ -157,7 +157,7 @@ usr_add(char *str)
|
|||
if ((pt = usrtb[indx]) != NULL) {
|
||||
while (pt != NULL) {
|
||||
if (pt->uid == uid)
|
||||
return(0);
|
||||
return 0;
|
||||
pt = pt->fow;
|
||||
}
|
||||
}
|
||||
|
@ -169,10 +169,10 @@ usr_add(char *str)
|
|||
pt->uid = uid;
|
||||
pt->fow = usrtb[indx];
|
||||
usrtb[indx] = pt;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
tty_warn(1, "User selection table out of memory");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -193,14 +193,14 @@ usr_match(ARCHD *arcn)
|
|||
pt = usrtb[((unsigned)arcn->sb.st_uid) % USR_TB_SZ];
|
||||
while (pt != NULL) {
|
||||
if (pt->uid == arcn->sb.st_uid)
|
||||
return(0);
|
||||
return 0;
|
||||
pt = pt->fow;
|
||||
}
|
||||
|
||||
/*
|
||||
* not found
|
||||
*/
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -222,12 +222,12 @@ grp_add(char *str)
|
|||
* create the table if it doesn't exist
|
||||
*/
|
||||
if ((str == NULL) || (*str == '\0'))
|
||||
return(-1);
|
||||
return -1;
|
||||
if ((grptb == NULL) &&
|
||||
((grptb = (GRPT **)calloc(GRP_TB_SZ, sizeof(GRPT *))) == NULL)) {
|
||||
tty_warn(1,
|
||||
"Unable to allocate memory fo group selection table");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -242,7 +242,7 @@ grp_add(char *str)
|
|||
if ((gr = getgrnam(str)) == NULL) {
|
||||
tty_warn(1,
|
||||
"Cannot determine gid for group name: %s", str);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
gid = (gid_t)gr->gr_gid;
|
||||
} else
|
||||
|
@ -256,7 +256,7 @@ grp_add(char *str)
|
|||
if ((pt = grptb[indx]) != NULL) {
|
||||
while (pt != NULL) {
|
||||
if (pt->gid == gid)
|
||||
return(0);
|
||||
return 0;
|
||||
pt = pt->fow;
|
||||
}
|
||||
}
|
||||
|
@ -268,10 +268,10 @@ grp_add(char *str)
|
|||
pt->gid = gid;
|
||||
pt->fow = grptb[indx];
|
||||
grptb[indx] = pt;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
tty_warn(1, "Group selection table out of memory");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -292,14 +292,14 @@ grp_match(ARCHD *arcn)
|
|||
pt = grptb[((unsigned)arcn->sb.st_gid) % GRP_TB_SZ];
|
||||
while (pt != NULL) {
|
||||
if (pt->gid == arcn->sb.st_gid)
|
||||
return(0);
|
||||
return 0;
|
||||
pt = pt->fow;
|
||||
}
|
||||
|
||||
/*
|
||||
* not found
|
||||
*/
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -345,7 +345,7 @@ trng_add(char *str)
|
|||
*/
|
||||
if ((str == NULL) || (*str == '\0')) {
|
||||
tty_warn(1, "Empty time range string");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -380,7 +380,7 @@ trng_add(char *str)
|
|||
*/
|
||||
if ((pt = (TIME_RNG *)malloc(sizeof(TIME_RNG))) == NULL) {
|
||||
tty_warn(1, "Unable to allocate memory for time range");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -446,7 +446,7 @@ trng_add(char *str)
|
|||
"Upper %s and lower %s time overlap",
|
||||
up_pt, str);
|
||||
(void)free((char *)pt);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -454,15 +454,15 @@ trng_add(char *str)
|
|||
pt->fow = NULL;
|
||||
if (trhead == NULL) {
|
||||
trtail = trhead = pt;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
trtail->fow = pt;
|
||||
trtail = pt;
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
out:
|
||||
tty_warn(1, "Time range format is: [yy[mm[dd[hh]]]]mm[.ss][/[c][m]]");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -529,8 +529,8 @@ trng_match(ARCHD *arcn)
|
|||
}
|
||||
|
||||
if (pt == NULL)
|
||||
return(1);
|
||||
return(0);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -557,7 +557,7 @@ str_sec(const char *p, time_t *tval)
|
|||
dot = t;
|
||||
continue;
|
||||
}
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
lt = localtime(tval);
|
||||
|
@ -565,7 +565,7 @@ str_sec(const char *p, time_t *tval)
|
|||
if (dot != NULL) {
|
||||
len = strlen(dot);
|
||||
if (len != 3)
|
||||
return(-1);
|
||||
return -1;
|
||||
++dot;
|
||||
lt->tm_sec = ATOI2(dot);
|
||||
} else {
|
||||
|
@ -604,13 +604,13 @@ str_sec(const char *p, time_t *tval)
|
|||
lt->tm_min = ATOI2(p);
|
||||
break;
|
||||
default:
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* convert broken-down time to GMT clock time seconds
|
||||
*/
|
||||
if ((*tval = mktime(lt)) == -1)
|
||||
return(-1);
|
||||
return(0);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
|
112
bin/pax/tables.c
112
bin/pax/tables.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tables.c,v 1.24 2005/09/16 17:05:14 christos Exp $ */
|
||||
/* $NetBSD: tables.c,v 1.25 2006/02/11 10:43:18 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
|
@ -42,7 +42,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)tables.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: tables.c,v 1.24 2005/09/16 17:05:14 christos Exp $");
|
||||
__RCSID("$NetBSD: tables.c,v 1.25 2006/02/11 10:43:18 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -117,12 +117,12 @@ int
|
|||
lnk_start(void)
|
||||
{
|
||||
if (ltab != NULL)
|
||||
return(0);
|
||||
return 0;
|
||||
if ((ltab = (HRDLNK **)calloc(L_TAB_SZ, sizeof(HRDLNK *))) == NULL) {
|
||||
tty_warn(1, "Cannot allocate memory for hard link table");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -145,12 +145,12 @@ chk_lnk(ARCHD *arcn)
|
|||
u_int indx;
|
||||
|
||||
if (ltab == NULL)
|
||||
return(-1);
|
||||
return -1;
|
||||
/*
|
||||
* ignore those nodes that cannot have hard links
|
||||
*/
|
||||
if ((arcn->type == PAX_DIR) || (arcn->sb.st_nlink <= 1))
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* hash inode number and look for this file
|
||||
|
@ -192,7 +192,7 @@ chk_lnk(ARCHD *arcn)
|
|||
(void)free((char *)pt->name);
|
||||
(void)free((char *)pt);
|
||||
}
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -207,13 +207,13 @@ chk_lnk(ARCHD *arcn)
|
|||
pt->nlink = arcn->sb.st_nlink;
|
||||
pt->fow = ltab[indx];
|
||||
ltab[indx] = pt;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
(void)free((char *)pt);
|
||||
}
|
||||
|
||||
tty_warn(1, "Hard link table out of memory");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -341,10 +341,10 @@ int
|
|||
ftime_start(void)
|
||||
{
|
||||
if (ftab != NULL)
|
||||
return(0);
|
||||
return 0;
|
||||
if ((ftab = (FTM **)calloc(F_TAB_SZ, sizeof(FTM *))) == NULL) {
|
||||
tty_warn(1, "Cannot allocate memory for file time table");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -355,11 +355,11 @@ ftime_start(void)
|
|||
if ((ffd = mkstemp(tempfile)) == -1) {
|
||||
syswarn(1, errno, "Unable to create temporary file: %s",
|
||||
tempfile);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
(void)unlink(tempfile);
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -386,7 +386,7 @@ chk_ftime(ARCHD *arcn)
|
|||
* no info, go ahead and add to archive
|
||||
*/
|
||||
if (ftab == NULL)
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* hash the pathname and look up in table
|
||||
|
@ -408,12 +408,12 @@ chk_ftime(ARCHD *arcn)
|
|||
if (lseek(ffd,pt->seek,SEEK_SET) != pt->seek) {
|
||||
syswarn(1, errno,
|
||||
"Failed ftime table seek");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
if (xread(ffd, ckname, namelen) != namelen) {
|
||||
syswarn(1, errno,
|
||||
"Failed ftime table read");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -438,12 +438,12 @@ chk_ftime(ARCHD *arcn)
|
|||
* file is newer
|
||||
*/
|
||||
pt->mtime = arcn->sb.st_mtime;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* file is older
|
||||
*/
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@ chk_ftime(ARCHD *arcn)
|
|||
pt->namelen = namelen;
|
||||
pt->fow = ftab[indx];
|
||||
ftab[indx] = pt;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
syswarn(1, errno, "Failed write to file time table");
|
||||
} else
|
||||
|
@ -471,7 +471,7 @@ chk_ftime(ARCHD *arcn)
|
|||
|
||||
if (pt != NULL)
|
||||
(void)free((char *)pt);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -497,13 +497,13 @@ int
|
|||
name_start(void)
|
||||
{
|
||||
if (ntab != NULL)
|
||||
return(0);
|
||||
return 0;
|
||||
if ((ntab = (NAMT **)calloc(N_TAB_SZ, sizeof(NAMT *))) == NULL) {
|
||||
tty_warn(1,
|
||||
"Cannot allocate memory for interactive rename table");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -526,7 +526,7 @@ add_name(char *oname, int onamelen, char *nname)
|
|||
* should never happen
|
||||
*/
|
||||
tty_warn(0, "No interactive rename table, links may fail\n");
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -547,14 +547,14 @@ add_name(char *oname, int onamelen, char *nname)
|
|||
* the user just input (if it is different)
|
||||
*/
|
||||
if (strcmp(nname, pt->nname) == 0)
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
(void)free((char *)pt->nname);
|
||||
if ((pt->nname = strdup(nname)) == NULL) {
|
||||
tty_warn(1, "Cannot update rename table");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -566,14 +566,14 @@ add_name(char *oname, int onamelen, char *nname)
|
|||
if ((pt->nname = strdup(nname)) != NULL) {
|
||||
pt->fow = ntab[indx];
|
||||
ntab[indx] = pt;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
(void)free((char *)pt->oname);
|
||||
}
|
||||
(void)free((char *)pt);
|
||||
}
|
||||
tty_warn(1, "Interactive rename table out of memory");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -670,12 +670,12 @@ int
|
|||
dev_start(void)
|
||||
{
|
||||
if (dtab != NULL)
|
||||
return(0);
|
||||
return 0;
|
||||
if ((dtab = (DEVT **)calloc(D_TAB_SZ, sizeof(DEVT *))) == NULL) {
|
||||
tty_warn(1, "Cannot allocate memory for device mapping table");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -692,8 +692,8 @@ int
|
|||
add_dev(ARCHD *arcn)
|
||||
{
|
||||
if (chk_dev(arcn->sb.st_dev, 1) == NULL)
|
||||
return(-1);
|
||||
return(0);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -716,7 +716,7 @@ chk_dev(dev_t dev, int add)
|
|||
u_int indx;
|
||||
|
||||
if (dtab == NULL)
|
||||
return(NULL);
|
||||
return NULL;
|
||||
/*
|
||||
* look to see if this device is already in the table
|
||||
*/
|
||||
|
@ -729,7 +729,7 @@ chk_dev(dev_t dev, int add)
|
|||
* found it, return a pointer to it
|
||||
*/
|
||||
if (pt != NULL)
|
||||
return(pt);
|
||||
return pt;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -737,7 +737,7 @@ chk_dev(dev_t dev, int add)
|
|||
* to see if a device number is being used.
|
||||
*/
|
||||
if (add == 0)
|
||||
return(NULL);
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* allocate a node for this device and add it to the front of the hash
|
||||
|
@ -746,13 +746,13 @@ chk_dev(dev_t dev, int add)
|
|||
*/
|
||||
if ((pt = (DEVT *)malloc(sizeof(DEVT))) == NULL) {
|
||||
tty_warn(1, "Device map table out of memory");
|
||||
return(NULL);
|
||||
return NULL;
|
||||
}
|
||||
pt->dev = dev;
|
||||
pt->list = NULL;
|
||||
pt->fow = dtab[indx];
|
||||
dtab[indx] = pt;
|
||||
return(pt);
|
||||
return pt;
|
||||
}
|
||||
/*
|
||||
* map_dev()
|
||||
|
@ -779,7 +779,7 @@ map_dev(ARCHD *arcn, u_long dev_mask, u_long ino_mask)
|
|||
ino_t nino;
|
||||
|
||||
if (dtab == NULL)
|
||||
return(0);
|
||||
return 0;
|
||||
/*
|
||||
* check for device and inode truncation, and extract the truncated
|
||||
* bit pattern.
|
||||
|
@ -810,7 +810,7 @@ map_dev(ARCHD *arcn, u_long dev_mask, u_long ino_mask)
|
|||
*/
|
||||
arcn->sb.st_dev = dpt->dev;
|
||||
arcn->sb.st_ino = nino;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
|
@ -818,7 +818,7 @@ map_dev(ARCHD *arcn, u_long dev_mask, u_long ino_mask)
|
|||
* form of truncation, we do not need a remap
|
||||
*/
|
||||
if (!trc_ino && !trc_dev)
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* we have truncation, have to add this as a device to remap
|
||||
|
@ -876,14 +876,14 @@ map_dev(ARCHD *arcn, u_long dev_mask, u_long ino_mask)
|
|||
pt->list = dpt;
|
||||
arcn->sb.st_dev = lastdev;
|
||||
arcn->sb.st_ino = nino;
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
bad:
|
||||
tty_warn(1,
|
||||
"Unable to fix truncated inode/device field when storing %s",
|
||||
arcn->name);
|
||||
tty_warn(0, "Archive may create improper hard links when extracted");
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -914,13 +914,13 @@ int
|
|||
atdir_start(void)
|
||||
{
|
||||
if (atab != NULL)
|
||||
return(0);
|
||||
return 0;
|
||||
if ((atab = (ATDIR **)calloc(A_TAB_SZ, sizeof(ATDIR *))) == NULL) {
|
||||
tty_warn(1,
|
||||
"Cannot allocate space for directory access time table");
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1032,13 +1032,13 @@ get_atdir(dev_t dev, ino_t ino, time_t *mtime, time_t *atime)
|
|||
u_int indx;
|
||||
|
||||
if (atab == NULL)
|
||||
return(-1);
|
||||
return -1;
|
||||
/*
|
||||
* hash by inode and search the chain for an inode and device match
|
||||
*/
|
||||
indx = ((unsigned)ino) % A_TAB_SZ;
|
||||
if ((pt = atab[indx]) == NULL)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
ppt = &(atab[indx]);
|
||||
while (pt != NULL) {
|
||||
|
@ -1055,7 +1055,7 @@ get_atdir(dev_t dev, ino_t ino, time_t *mtime, time_t *atime)
|
|||
* return if we did not find it.
|
||||
*/
|
||||
if (pt == NULL)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* found it. return the times and remove the entry from the table.
|
||||
|
@ -1065,7 +1065,7 @@ get_atdir(dev_t dev, ino_t ino, time_t *mtime, time_t *atime)
|
|||
*atime = pt->atime;
|
||||
(void)free((char *)pt->name);
|
||||
(void)free((char *)pt);
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1108,7 +1108,7 @@ dir_start(void)
|
|||
{
|
||||
#ifdef DIRS_USE_FILE
|
||||
if (dirfd != -1)
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* unlink the file so it goes away at termination by itself
|
||||
|
@ -1116,11 +1116,11 @@ dir_start(void)
|
|||
memcpy(tempbase, _TFILE_BASE, sizeof(_TFILE_BASE));
|
||||
if ((dirfd = mkstemp(tempfile)) >= 0) {
|
||||
(void)unlink(tempfile);
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
tty_warn(1, "Unable to create temporary file for directory times: %s",
|
||||
tempfile);
|
||||
return(-1);
|
||||
return -1;
|
||||
#else
|
||||
return (0);
|
||||
#endif /* DIRS_USE_FILE */
|
||||
|
@ -1360,5 +1360,5 @@ st_hash(char *name, int len, int tabsz)
|
|||
/*
|
||||
* return the result mod the table size
|
||||
*/
|
||||
return(key % tabsz);
|
||||
return key % tabsz;
|
||||
}
|
||||
|
|
118
bin/pax/tar.c
118
bin/pax/tar.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tar.c,v 1.62 2005/04/24 01:23:21 christos Exp $ */
|
||||
/* $NetBSD: tar.c,v 1.63 2006/02/11 10:43:18 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
|
@ -42,7 +42,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: tar.c,v 1.62 2005/04/24 01:23:21 christos Exp $");
|
||||
__RCSID("$NetBSD: tar.c,v 1.63 2006/02/11 10:43:18 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -120,9 +120,9 @@ check_sum(char *hd, size_t hdlen, char *bl, size_t bllen, int quiet)
|
|||
if (!quiet)
|
||||
tty_warn(0, "Header checksum %lo does not match %lo",
|
||||
hdck, blck);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -136,7 +136,7 @@ check_sum(char *hd, size_t hdlen, char *bl, size_t bllen, int quiet)
|
|||
int
|
||||
tar_endwr(void)
|
||||
{
|
||||
return(wr_skip((off_t)(NULLCNT * BLKMULT)));
|
||||
return wr_skip((off_t)(NULLCNT * BLKMULT));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -149,7 +149,7 @@ tar_endwr(void)
|
|||
off_t
|
||||
tar_endrd(void)
|
||||
{
|
||||
return((off_t)((gnu_short_trailer ? 1 : NULLCNT) * BLKMULT));
|
||||
return (off_t)((gnu_short_trailer ? 1 : NULLCNT) * BLKMULT);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -181,7 +181,7 @@ tar_trail(char *buf, int in_resync, int *cnt)
|
|||
* if not all zero it is not a trailer, but MIGHT be a header.
|
||||
*/
|
||||
if (i != BLKMULT)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* When given a zero block, we must be careful!
|
||||
|
@ -202,9 +202,9 @@ tar_trail(char *buf, int in_resync, int *cnt)
|
|||
++*cnt;
|
||||
}
|
||||
if (*cnt >= NULLCNT)
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -257,8 +257,8 @@ ul_oct(u_long val, char *str, int len, int term)
|
|||
while (pt >= str)
|
||||
*pt-- = '0';
|
||||
if (val != (u_long)0)
|
||||
return(-1);
|
||||
return(0);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(NET2_STAT) && !defined(_LP64)
|
||||
|
@ -312,8 +312,8 @@ ull_oct(unsigned long long val, char *str, int len, int term)
|
|||
while (pt >= str)
|
||||
*pt-- = '0';
|
||||
if (val != (unsigned long long)0)
|
||||
return(-1);
|
||||
return(0);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -352,7 +352,7 @@ tar_chksm(char *blk, int len)
|
|||
stop = blk + len;
|
||||
while (pt < stop)
|
||||
chksm += (u_long)(*pt++ & 0xff);
|
||||
return(chksm);
|
||||
return chksm;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -376,7 +376,7 @@ tar_id(char *blk, int size)
|
|||
static int is_ustar = -1;
|
||||
|
||||
if (size < BLKMULT)
|
||||
return(-1);
|
||||
return -1;
|
||||
hd = (HD_TAR *)blk;
|
||||
uhd = (HD_USTAR *)blk;
|
||||
|
||||
|
@ -388,11 +388,11 @@ tar_id(char *blk, int size)
|
|||
* checksum. If this is ok we have to assume it is a valid header.
|
||||
*/
|
||||
if (hd->name[0] == '\0')
|
||||
return(-1);
|
||||
return -1;
|
||||
if (strncmp(uhd->magic, TMAGIC, TMAGLEN - 1) == 0) {
|
||||
if (is_ustar == -1) {
|
||||
is_ustar = 1;
|
||||
return(-1);
|
||||
return -1;
|
||||
} else
|
||||
tty_warn(0,
|
||||
"Busted tar archive: has both ustar and old tar "
|
||||
|
@ -423,7 +423,7 @@ tar_opt(void)
|
|||
tty_warn(1,
|
||||
"%s=%s is the only supported tar format option",
|
||||
TAR_OPTION, TAR_NODIR);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -432,11 +432,11 @@ tar_opt(void)
|
|||
if ((act != APPND) && (act != ARCHIVE)) {
|
||||
tty_warn(1, "%s=%s is only supported when writing.",
|
||||
opt->name, opt->value);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
tar_nodir = 1;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -458,7 +458,7 @@ tar_rd(ARCHD *arcn, char *buf)
|
|||
* we only get proper sized buffers passed to us
|
||||
*/
|
||||
if (tar_id(buf, BLKMULT) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
memset(arcn, 0, sizeof(*arcn));
|
||||
arcn->org_name = arcn->name;
|
||||
arcn->pat = NULL;
|
||||
|
@ -564,7 +564,7 @@ tar_rd(ARCHD *arcn, char *buf)
|
|||
*pt = '\0';
|
||||
--arcn->nlen;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -595,29 +595,29 @@ tar_wr(ARCHD *arcn)
|
|||
* user asked that dirs not be written to the archive
|
||||
*/
|
||||
if (tar_nodir)
|
||||
return(1);
|
||||
return 1;
|
||||
break;
|
||||
case PAX_CHR:
|
||||
tty_warn(1, "Tar cannot archive a character device %s",
|
||||
arcn->org_name);
|
||||
return(1);
|
||||
return 1;
|
||||
case PAX_BLK:
|
||||
tty_warn(1,
|
||||
"Tar cannot archive a block device %s", arcn->org_name);
|
||||
return(1);
|
||||
return 1;
|
||||
case PAX_SCK:
|
||||
tty_warn(1, "Tar cannot archive a socket %s", arcn->org_name);
|
||||
return(1);
|
||||
return 1;
|
||||
case PAX_FIF:
|
||||
tty_warn(1, "Tar cannot archive a fifo %s", arcn->org_name);
|
||||
return(1);
|
||||
return 1;
|
||||
case PAX_SLK:
|
||||
case PAX_HLK:
|
||||
case PAX_HRG:
|
||||
if (arcn->ln_nlen > sizeof(hd->linkname)) {
|
||||
tty_warn(1,"Link name too long for tar %s",
|
||||
arcn->ln_name);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case PAX_REG:
|
||||
|
@ -634,7 +634,7 @@ tar_wr(ARCHD *arcn)
|
|||
++len;
|
||||
if (len >= sizeof(hd->name)) {
|
||||
tty_warn(1, "File name too long for tar %s", arcn->name);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -684,7 +684,7 @@ tar_wr(ARCHD *arcn)
|
|||
if (OFFT_OCT(arcn->sb.st_size, hd->size, sizeof(hd->size), 1)) {
|
||||
tty_warn(1,"File is too large for tar %s",
|
||||
arcn->org_name);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
arcn->pad = TAR_PAD(arcn->sb.st_size);
|
||||
}
|
||||
|
@ -712,19 +712,19 @@ tar_wr(ARCHD *arcn)
|
|||
* seems incorrect */
|
||||
|
||||
if (wr_rdbuf(hdblk, sizeof(HD_TAR)) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
if (wr_skip((off_t)(BLKMULT - sizeof(HD_TAR))) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
if ((arcn->type == PAX_CTG) || (arcn->type == PAX_REG))
|
||||
return(0);
|
||||
return(1);
|
||||
return 0;
|
||||
return 1;
|
||||
|
||||
out:
|
||||
/*
|
||||
* header field is out of range
|
||||
*/
|
||||
tty_warn(1, "Tar header field is too small for %s", arcn->org_name);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -741,7 +741,7 @@ tar_wr(ARCHD *arcn)
|
|||
int
|
||||
ustar_strd(void)
|
||||
{
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -754,7 +754,7 @@ ustar_strd(void)
|
|||
int
|
||||
ustar_stwr(void)
|
||||
{
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -771,7 +771,7 @@ ustar_id(char *blk, int size)
|
|||
HD_USTAR *hd;
|
||||
|
||||
if (size < BLKMULT)
|
||||
return(-1);
|
||||
return -1;
|
||||
hd = (HD_USTAR *)blk;
|
||||
|
||||
/*
|
||||
|
@ -781,9 +781,9 @@ ustar_id(char *blk, int size)
|
|||
* check the checksum. If ok we have to assume it is a valid header.
|
||||
*/
|
||||
if (hd->name[0] == '\0')
|
||||
return(-1);
|
||||
return -1;
|
||||
if (strncmp(hd->magic, TMAGIC, TMAGLEN - 1) != 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
/* This is GNU tar */
|
||||
if (strncmp(hd->magic, "ustar ", 8) == 0 && !is_gnutar &&
|
||||
!seen_gnu_warning) {
|
||||
|
@ -815,7 +815,7 @@ ustar_rd(ARCHD *arcn, char *buf)
|
|||
* we only get proper sized buffers
|
||||
*/
|
||||
if (ustar_id(buf, BLKMULT) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
memset(arcn, 0, sizeof(*arcn));
|
||||
arcn->org_name = arcn->name;
|
||||
|
@ -959,7 +959,7 @@ ustar_rd(ARCHD *arcn, char *buf)
|
|||
arcn->sb.st_mode |= S_IFREG;
|
||||
break;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1047,7 +1047,7 @@ ustar_wr(ARCHD *arcn)
|
|||
if (!is_gnutar)
|
||||
tty_warn(1, "Ustar cannot archive a socket %s",
|
||||
arcn->org_name);
|
||||
return(1);
|
||||
return 1;
|
||||
|
||||
case PAX_SLK:
|
||||
case PAX_HLK:
|
||||
|
@ -1061,7 +1061,7 @@ ustar_wr(ARCHD *arcn)
|
|||
} else {
|
||||
tty_warn(1, "Link name too long for ustar %s",
|
||||
arcn->ln_name);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1080,7 +1080,7 @@ ustar_wr(ARCHD *arcn)
|
|||
} else {
|
||||
tty_warn(1, "File name too long for ustar %s",
|
||||
arcn->name);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1166,7 +1166,7 @@ ustar_wr(ARCHD *arcn)
|
|||
sizeof(hd->size), 3)) {
|
||||
tty_warn(1,"File is too long for ustar %s",
|
||||
arcn->org_name);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (arcn->type == PAX_CTG)
|
||||
|
@ -1178,7 +1178,7 @@ ustar_wr(ARCHD *arcn)
|
|||
sizeof(hd->size), 3)) {
|
||||
tty_warn(1,"File is too long for ustar %s",
|
||||
arcn->org_name);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1216,22 +1216,22 @@ ustar_wr(ARCHD *arcn)
|
|||
sizeof(hd->chksum), 3))
|
||||
return size_err("CHKSUM", arcn);
|
||||
if (wr_rdbuf(hdblk, sizeof(HD_USTAR)) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
if (wr_skip((off_t)(BLKMULT - sizeof(HD_USTAR))) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
if (gnu_hack_string) {
|
||||
int res = wr_rdbuf(gnu_hack_string, gnu_hack_len);
|
||||
int pad = gnu_hack_len;
|
||||
gnu_hack_string = NULL;
|
||||
gnu_hack_len = 0;
|
||||
if (res < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
if (wr_skip((off_t)(BLKMULT - (pad % BLKMULT))) < 0)
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
if ((arcn->type == PAX_CTG) || (arcn->type == PAX_REG))
|
||||
return(0);
|
||||
return(1);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1256,7 +1256,7 @@ name_split(char *name, int len)
|
|||
* field. if so just return a pointer to the name.
|
||||
*/
|
||||
if (len < TNMSZ)
|
||||
return(name);
|
||||
return name;
|
||||
/*
|
||||
* GNU tar does not honor the prefix+name mode if the magic
|
||||
* is not "ustar\0". So in GNU tar compatibility mode, we don't
|
||||
|
@ -1266,7 +1266,7 @@ name_split(char *name, int len)
|
|||
* really need do, but we are behaving like GNU tar after all.
|
||||
*/
|
||||
if (is_gnutar || len > (TPFSZ + TNMSZ))
|
||||
return(NULL);
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* we start looking at the biggest sized piece that fits in the name
|
||||
|
@ -1284,7 +1284,7 @@ name_split(char *name, int len)
|
|||
* cannot store this file.
|
||||
*/
|
||||
if (*start == '\0')
|
||||
return(NULL);
|
||||
return NULL;
|
||||
len = start - name;
|
||||
|
||||
/*
|
||||
|
@ -1294,12 +1294,12 @@ name_split(char *name, int len)
|
|||
* makes this special case follow the spec to the letter.
|
||||
*/
|
||||
if ((len >= TPFSZ) || (len == 0))
|
||||
return(NULL);
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* ok have a split point, return it to the caller
|
||||
*/
|
||||
return(start);
|
||||
return start;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1389,7 +1389,7 @@ tar_gnutar_X_compat(path)
|
|||
if (fp == NULL) {
|
||||
tty_warn(1, "cannot open %s: %s", path,
|
||||
strerror(errno));
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
while ((line = fgetln(fp, &len))) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tty_subs.c,v 1.17 2004/10/10 21:54:24 christos Exp $ */
|
||||
/* $NetBSD: tty_subs.c,v 1.18 2006/02/11 10:43:18 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
|
@ -42,7 +42,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)tty_subs.c 8.2 (Berkeley) 4/18/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: tty_subs.c,v 1.17 2004/10/10 21:54:24 christos Exp $");
|
||||
__RCSID("$NetBSD: tty_subs.c,v 1.18 2006/02/11 10:43:18 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -83,7 +83,7 @@ tty_init(void)
|
|||
if ((ttyfd = open(DEVTTY, O_RDWR)) >= 0) {
|
||||
if ((ttyoutf = fdopen(ttyfd, "w")) != NULL) {
|
||||
if ((ttyinf = fdopen(ttyfd, "r")) != NULL)
|
||||
return(0);
|
||||
return 0;
|
||||
(void)fclose(ttyoutf);
|
||||
}
|
||||
(void)close(ttyfd);
|
||||
|
@ -91,9 +91,9 @@ tty_init(void)
|
|||
|
||||
if (iflag) {
|
||||
tty_warn(1, "Fatal error, cannot open %s", DEVTTY);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -128,7 +128,7 @@ tty_read(char *str, int len)
|
|||
char *pt;
|
||||
|
||||
if ((--len <= 0) || (ttyinf == NULL) || (fgets(str,len,ttyinf) == NULL))
|
||||
return(-1);
|
||||
return -1;
|
||||
*(str + len) = '\0';
|
||||
|
||||
/*
|
||||
|
@ -136,7 +136,7 @@ tty_read(char *str, int len)
|
|||
*/
|
||||
if ((pt = strchr(str, '\n')) != NULL)
|
||||
*pt = '\0';
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue