summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2001-05-16 03:05:00 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2001-05-16 03:05:00 +0000
commita6cba63b13007c47209fca64dbe16f5d594493bf (patch)
treec41d9a1481c80fc5dd38a3f34c78b2bdd6e1dd8b /bin
parent11041f947a8a8c2fabec695efdb740beb263a3bb (diff)
use proper str*cpy functions instead of home grown one, spaces; millert@ ok
Diffstat (limited to 'bin')
-rw-r--r--bin/pax/ar_io.c26
-rw-r--r--bin/pax/ar_subs.c40
-rw-r--r--bin/pax/buf_subs.c18
-rw-r--r--bin/pax/cpio.c24
-rw-r--r--bin/pax/cpio.h10
-rw-r--r--bin/pax/extern.h5
-rw-r--r--bin/pax/file_subs.c10
-rw-r--r--bin/pax/ftree.c11
-rw-r--r--bin/pax/gen_subs.c45
-rw-r--r--bin/pax/pat_rep.c54
-rw-r--r--bin/pax/pax.c18
-rw-r--r--bin/pax/pax.h10
-rw-r--r--bin/pax/tables.c12
-rw-r--r--bin/pax/tables.h4
-rw-r--r--bin/pax/tar.c55
15 files changed, 147 insertions, 195 deletions
diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c
index 02acf481888..a67a4f8d80e 100644
--- a/bin/pax/ar_io.c
+++ b/bin/pax/ar_io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar_io.c,v 1.20 2000/06/09 16:37:54 espie Exp $ */
+/* $OpenBSD: ar_io.c,v 1.21 2001/05/16 03:04:54 mickey Exp $ */
/* $NetBSD: ar_io.c,v 1.5 1996/03/26 23:54:13 mrg Exp $ */
/*-
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94";
#else
-static char rcsid[] = "$OpenBSD: ar_io.c,v 1.20 2000/06/09 16:37:54 espie Exp $";
+static char rcsid[] = "$OpenBSD: ar_io.c,v 1.21 2001/05/16 03:04:54 mickey Exp $";
#endif
#endif /* not lint */
@@ -295,7 +295,7 @@ ar_open(name)
break;
default:
/*
- * should never happen, worse case, slow...
+ * should never happen, worse case, slow...
*/
blksz = rdblksz = BLKMULT;
break;
@@ -483,7 +483,7 @@ ar_set_wr()
*/
wr_trail = 0;
- /*
+ /*
* Add any device dependent code as required here
*/
if (artyp != ISREG)
@@ -504,7 +504,7 @@ ar_set_wr()
/*
* ar_app_ok()
* check if the last volume in the archive allows appends. We cannot check
- * this until we are ready to write since there is no spec that says all
+ * this until we are ready to write since there is no spec that says all
* volumes in a single archive have to be of the same type...
* Return:
* 0 if we can append, -1 otherwise.
@@ -667,10 +667,10 @@ ar_write(buf, bsz)
case ISREG:
if ((res > 0) && (res % BLKMULT)) {
/*
- * try to fix up partial writes which are not BLKMULT
+ * try to fix up partial writes which are not BLKMULT
* in size by forcing the runt record to next archive
* volume
- */
+ */
if ((cpos = lseek(arfd, (off_t)0L, SEEK_CUR)) < 0)
break;
cpos -= (off_t)res;
@@ -881,12 +881,12 @@ ar_fow(sksz, skipped)
* figure out where we are in the archive
*/
if ((cpos = lseek(arfd, (off_t)0L, SEEK_CUR)) >= 0) {
- /*
- * we can be asked to move farther than there are bytes in this
+ /*
+ * we can be asked to move farther than there are bytes in this
* volume, if so, just go to file end and let normal buf_fill()
* deal with the end of file (it will go to next volume by
* itself)
- */
+ */
if ((mpos = cpos + sksz) > arsb.st_size) {
*skipped = arsb.st_size - cpos;
mpos = arsb.st_size;
@@ -987,12 +987,12 @@ ar_rev(sksz)
break;
case ISTAPE:
/*
- * Calculate and move the proper number of PHYSICAL tape
+ * Calculate and move the proper number of PHYSICAL tape
* blocks. If the sksz is not an even multiple of the physical
* tape size, we cannot do the move (this should never happen).
* (We also cannot handler trailers spread over two vols).
* get_phys() also makes sure we are in front of the filemark.
- */
+ */
if ((phyblk = get_phys()) <= 0) {
lstrval = -1;
return(-1);
@@ -1041,7 +1041,7 @@ ar_rev(sksz)
/*
* get_phys()
* Determine the physical block size on a tape drive. We need the physical
- * block size so we know how many bytes we skip over when we move with
+ * block size so we know how many bytes we skip over when we move with
* mtio commands. We also make sure we are BEFORE THE TAPE FILEMARK when
* return.
* This is one really SLOW routine...
diff --git a/bin/pax/ar_subs.c b/bin/pax/ar_subs.c
index 46868823185..346a7141730 100644
--- a/bin/pax/ar_subs.c
+++ b/bin/pax/ar_subs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar_subs.c,v 1.14 1998/09/20 02:22:21 millert Exp $ */
+/* $OpenBSD: ar_subs.c,v 1.15 2001/05/16 03:04:55 mickey Exp $ */
/* $NetBSD: ar_subs.c,v 1.5 1995/03/21 09:07:06 cgd Exp $ */
/*-
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)ar_subs.c 8.2 (Berkeley) 4/18/94";
#else
-static char rcsid[] = "$OpenBSD: ar_subs.c,v 1.14 1998/09/20 02:22:21 millert Exp $";
+static char rcsid[] = "$OpenBSD: ar_subs.c,v 1.15 2001/05/16 03:04:55 mickey Exp $";
#endif
#endif /* not lint */
@@ -479,7 +479,7 @@ wr_archive(arcn, is_app)
if ((res > 0) || (docrc && (set_crc(arcn, fd) < 0))) {
/*
* unable to obtain the crc we need, close the file,
- * purge link table entry
+ * purge link table entry
*/
rdfile_close(arcn, &fd);
purg_lnk(arcn);
@@ -506,7 +506,7 @@ wr_archive(arcn, is_app)
}
wr_one = 1;
if (res > 0) {
- /*
+ /*
* format write says no file data needs to be stored
* so we are done messing with this file
*/
@@ -569,7 +569,7 @@ wr_archive(arcn, is_app)
* is called to add the new members.
* PAX IMPLEMENTATION DETAIL NOTE:
* -u is implemented by adding the new members to the end of the archive.
- * Care is taken so that these do not end up as links to the older
+ * Care is taken so that these do not end up as links to the older
* version of the same file already stored in the archive. It is expected
* when extraction occurs these newer versions will over-write the older
* ones stored "earlier" in the archive (this may be a bad assumption as
@@ -711,7 +711,7 @@ append()
(void)fputs("done.\n", listf);
vfpart = 0;
}
-
+
/*
* go to the writing phase to add the new members
*/
@@ -778,13 +778,18 @@ copy()
* set up the destination dir path and make sure it is a directory. We
* make sure we have a trailing / on the destination
*/
- dlen = l_strncpy(dirbuf, dirptr, sizeof(dirbuf) - 1);
+ dlen = strlcpy(dirbuf, dirptr, sizeof(dirbuf));
+ if (dlen >= sizeof(dirbuf) ||
+ (dlen == sizeof(dirbuf) - 1 && dirbuf[dlen - 1] != '/')) {
+ paxwarn(1, "directory name is too long %s", dirptr);
+ return;
+ }
dest_pt = dirbuf + dlen;
if (*(dest_pt-1) != '/') {
*dest_pt++ = '/';
+ *dest_pt = '\0';
++dlen;
}
- *dest_pt = '\0';
drem = PAXPATHLEN - dlen;
if (stat(dirptr, &sb) < 0) {
@@ -799,7 +804,7 @@ copy()
/*
* start up the hard link table; file traversal routines and the
- * modification time and access mode database
+ * modification time and access mode database
*/
if ((lnk_start() < 0) || (ftree_start() < 0) || (dir_start() < 0))
return;
@@ -842,17 +847,12 @@ copy()
/*
* create the destination name
*/
- if (*(arcn->name) == '/')
- res = 1;
- else
- res = 0;
- if ((arcn->nlen - res) > drem) {
+ if (strlcpy(dest_pt, arcn->name + (*arcn->name == '/'),
+ drem + 1) > drem) {
paxwarn(1, "Destination pathname too long %s",
arcn->name);
continue;
}
- (void)strncpy(dest_pt, arcn->name + res, drem);
- dirbuf[PAXPATHLEN] = '\0';
/*
* if existing file is same age or newer skip
@@ -860,10 +860,10 @@ copy()
res = lstat(dirbuf, &sb);
*dest_pt = '\0';
- if (res == 0) {
+ if (res == 0) {
if (uflag && Dflag) {
if ((arcn->sb.st_mtime<=sb.st_mtime) &&
- (arcn->sb.st_ctime<=sb.st_ctime))
+ (arcn->sb.st_ctime<=sb.st_ctime))
continue;
} else if (Dflag) {
if (arcn->sb.st_ctime <= sb.st_ctime)
@@ -1020,7 +1020,7 @@ next_head(arcn)
register int res;
register int shftsz;
register int hsz;
- register int in_resync = 0; /* set when we are in resync mode */
+ register int in_resync = 0; /* set when we are in resync mode */
int cnt = 0; /* counter for trailer function */
int first = 1; /* on 1st read, EOF isn't premature. */
@@ -1238,7 +1238,7 @@ get_arc()
if ((*fsub[ford[i]].id)(hdbuf, hdsz) < 0)
continue;
frmt = &(fsub[ford[i]]);
- /*
+ /*
* yuck, to avoid slow special case code in the extract
* routines, just push this header back as if it was
* not seen. We have left extra space at start of the
diff --git a/bin/pax/buf_subs.c b/bin/pax/buf_subs.c
index ad5f78eb7b5..2aa67c87375 100644
--- a/bin/pax/buf_subs.c
+++ b/bin/pax/buf_subs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf_subs.c,v 1.7 1997/09/01 18:29:46 deraadt Exp $ */
+/* $OpenBSD: buf_subs.c,v 1.8 2001/05/16 03:04:55 mickey Exp $ */
/* $NetBSD: buf_subs.c,v 1.5 1995/03/21 09:07:08 cgd Exp $ */
/*-
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)buf_subs.c 8.2 (Berkeley) 4/18/94";
#else
-static char rcsid[] = "$OpenBSD: buf_subs.c,v 1.7 1997/09/01 18:29:46 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: buf_subs.c,v 1.8 2001/05/16 03:04:55 mickey Exp $";
#endif
#endif /* not lint */
@@ -124,7 +124,7 @@ wr_start()
}
/*
- * we only allow wrblksz to be used with all archive operations
+ * we only allow wrblksz to be used with all archive operations
*/
blksz = rdblksz = wrblksz;
if ((ar_open(arcname) < 0) && (ar_next() < 0))
@@ -164,7 +164,7 @@ rd_start()
}
if (wrblksz % BLKMULT) {
paxwarn(1, "Write block size %d is not a %d byte multiple",
- wrblksz, BLKMULT);
+ wrblksz, BLKMULT);
return(-1);
}
}
@@ -224,7 +224,7 @@ cp_start()
* about the conditions under which they will allow a write to occur.
* Often devices restrict the conditions where writes can be made writes,
* so it may not be feasable to append archives stored on all types of
- * devices.
+ * devices.
* Return:
* 0 for success, -1 for failure
*/
@@ -322,7 +322,7 @@ appnd_start(skcnt)
paxwarn(1, "Unable to rewrite archive trailer, cannot append.");
return(-1);
}
-
+
/*
* rd_sync()
* A read error occurred on this archive volume. Resync the buffer and
@@ -497,7 +497,7 @@ rd_skip(skcnt)
return(0);
}
-/*
+/*
* wr_fin()
* flush out any data (and pad if required) the last block. We always pad
* with zero (even though we do not have to). Padding with 0 makes it a
@@ -526,7 +526,7 @@ wr_fin()
* by format specific write routines to pass a file header). On failure we
* punt. We do not allow the user to continue to write flawed archives.
* We assume these headers are not very large (the memory copy we use is
- * a bit expensive).
+ * a bit expensive).
* Return:
* 0 if buffer was filled ok, -1 o.w. (buffer flush failure)
*/
@@ -760,7 +760,7 @@ rd_wrfile(arcn, ofd, left)
int isem = 1;
int rem;
int sz = MINFBSZ;
- struct stat sb;
+ struct stat sb;
u_long crc = 0L;
/*
diff --git a/bin/pax/cpio.c b/bin/pax/cpio.c
index 47bf5caa932..03d955b4571 100644
--- a/bin/pax/cpio.c
+++ b/bin/pax/cpio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpio.c,v 1.5 1997/07/25 18:58:28 mickey Exp $ */
+/* $OpenBSD: cpio.c,v 1.6 2001/05/16 03:04:56 mickey Exp $ */
/* $NetBSD: cpio.c,v 1.5 1995/03/21 09:07:13 cgd Exp $ */
/*-
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)cpio.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: cpio.c,v 1.5 1997/07/25 18:58:28 mickey Exp $";
+static char rcsid[] = "$OpenBSD: cpio.c,v 1.6 2001/05/16 03:04:56 mickey Exp $";
#endif
#endif /* not lint */
@@ -97,7 +97,7 @@ cpio_strd()
* mode; looking for a valid header), and cnt (which starts at zero)
* which is used to count the number of empty blocks we have seen so far.
* Return:
- * 0 if a valid trailer, -1 if not a valid trailer,
+ * 0 if a valid trailer, -1 if not a valid trailer,
*/
#ifdef __STDC__
@@ -381,8 +381,8 @@ cpio_rd(arcn, buf)
if (((arcn->sb.st_mode&C_IFMT) != C_ISLNK)||(arcn->sb.st_size == 0)) {
/*
- * no link name to read for this file
- */
+ * no link name to read for this file
+ */
arcn->ln_nlen = 0;
arcn->ln_name[0] = '\0';
return(com_rd(arcn));
@@ -576,7 +576,7 @@ cpio_wr(arcn)
/*
* vcpio_id()
* determine if a block given to us is a valid system VR4 cpio header
- * WITHOUT crc. WATCH it the magic cookies are in OCTAL, the header
+ * WITHOUT crc. WATCH it the magic cookies are in OCTAL, the header
* uses HEX
* Return:
* 0 if a valid header, -1 otherwise
@@ -825,13 +825,13 @@ vcpio_wr(arcn)
*/
if (docrc) {
if (ul_asc((u_long)VCMAGIC, hd->c_magic, sizeof(hd->c_magic),
- OCT) ||
+ OCT) ||
ul_asc((u_long)arcn->crc,hd->c_chksum,sizeof(hd->c_chksum),
- HEX))
+ HEX))
goto out;
} else {
if (ul_asc((u_long)VMAGIC, hd->c_magic, sizeof(hd->c_magic),
- OCT) ||
+ OCT) ||
ul_asc((u_long)0L, hd->c_chksum, sizeof(hd->c_chksum),HEX))
goto out;
}
@@ -888,11 +888,11 @@ vcpio_wr(arcn)
ul_asc((u_long)arcn->sb.st_uid, hd->c_uid, sizeof(hd->c_uid),
HEX) ||
ul_asc((u_long)arcn->sb.st_gid, hd->c_gid, sizeof(hd->c_gid),
- HEX) ||
+ HEX) ||
ul_asc((u_long)arcn->sb.st_mtime, hd->c_mtime, sizeof(hd->c_mtime),
- HEX) ||
+ HEX) ||
ul_asc((u_long)arcn->sb.st_nlink, hd->c_nlink, sizeof(hd->c_nlink),
- HEX) ||
+ HEX) ||
ul_asc((u_long)MAJOR(arcn->sb.st_dev),hd->c_maj, sizeof(hd->c_maj),
HEX) ||
ul_asc((u_long)MINOR(arcn->sb.st_dev),hd->c_min, sizeof(hd->c_min),
diff --git a/bin/pax/cpio.h b/bin/pax/cpio.h
index 811f8f3778a..3c7b76cc61b 100644
--- a/bin/pax/cpio.h
+++ b/bin/pax/cpio.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpio.h,v 1.2 1996/06/23 14:20:32 deraadt Exp $ */
+/* $OpenBSD: cpio.h,v 1.3 2001/05/16 03:04:56 mickey Exp $ */
/* $NetBSD: cpio.h,v 1.3 1995/03/21 09:07:15 cgd Exp $ */
/*-
@@ -73,7 +73,7 @@ typedef struct {
char c_mtime[11]; /* modification time */
char c_namesize[6]; /* length of pathname */
char c_filesize[11]; /* length of file in bytes */
-} HD_CPIO;
+} HD_CPIO;
#define MAGIC 070707 /* transportable archive id */
@@ -84,7 +84,7 @@ typedef struct {
#endif /* _PAX_ */
/*
- * Binary cpio header structure
+ * Binary cpio header structure
*
* CAUTION! CAUTION! CAUTION!
* Each field really represents a 16 bit short (NOT ASCII). Described as
@@ -104,7 +104,7 @@ typedef struct {
u_char h_namesize[2];
u_char h_filesize_1[2];
u_char h_filesize_2[2];
-} HD_BCPIO;
+} HD_BCPIO;
#ifdef _PAX_
/*
@@ -142,7 +142,7 @@ typedef struct {
char c_rmin[8]; /* special file minor # */
char c_namesize[8]; /* length of pathname */
char c_chksum[8]; /* 0 OR CRC of bytes of FILE data */
-} HD_VCPIO;
+} HD_VCPIO;
#define VMAGIC 070701 /* sVr4 new portable archive id */
#define VCMAGIC 070702 /* sVr4 new portable archive id CRC */
diff --git a/bin/pax/extern.h b/bin/pax/extern.h
index 71802cb5a98..d7c23c4dc52 100644
--- a/bin/pax/extern.h
+++ b/bin/pax/extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: extern.h,v 1.17 2001/02/07 19:04:14 millert Exp $ */
+/* $OpenBSD: extern.h,v 1.18 2001/05/16 03:04:56 mickey Exp $ */
/* $NetBSD: extern.h,v 1.5 1996/03/26 23:54:16 mrg Exp $ */
/*-
@@ -169,7 +169,6 @@ int next_file __P((register ARCHD *));
*/
void ls_list __P((register ARCHD *, time_t, FILE *));
void ls_tty __P((register ARCHD *));
-int l_strncpy __P((register char *, register char *, int));
u_long asc_ul __P((register char *, int, register int));
int ul_asc __P((u_long, register char *, register int, register int));
#ifndef NET2_STAT
@@ -177,7 +176,7 @@ u_quad_t asc_uqd __P((register char *, int, register int));
int uqd_asc __P((u_quad_t, register char *, register int, register int));
#endif
-/*
+/*
* getoldopt.c
*/
int getoldopt __P((int, char **, char *));
diff --git a/bin/pax/file_subs.c b/bin/pax/file_subs.c
index 2241c3885f1..670a2fdb309 100644
--- a/bin/pax/file_subs.c
+++ b/bin/pax/file_subs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file_subs.c,v 1.13 1997/09/01 18:29:48 deraadt Exp $ */
+/* $OpenBSD: file_subs.c,v 1.14 2001/05/16 03:04:56 mickey Exp $ */
/* $NetBSD: file_subs.c,v 1.4 1995/03/21 09:07:18 cgd Exp $ */
/*-
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)file_subs.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: file_subs.c,v 1.13 1997/09/01 18:29:48 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: file_subs.c,v 1.14 2001/05/16 03:04:56 mickey Exp $";
#endif
#endif /* not lint */
@@ -164,7 +164,7 @@ file_close(arcn, fd)
/*
* set owner/groups first as this may strip off mode bits we want
* then set file permission modes. Then set file access and
- * modification times.
+ * modification times.
*/
if (pids)
res = set_ids(arcn->name, arcn->sb.st_uid, arcn->sb.st_gid);
@@ -185,7 +185,7 @@ file_close(arcn, fd)
/*
* lnk_creat()
* Create a hard link to arcn->ln_name from arcn->name. arcn->ln_name
- * must exist;
+ * must exist;
* Return:
* 0 if ok, -1 otherwise
*/
@@ -271,7 +271,7 @@ chk_same(arcn)
{
struct stat sb;
- /*
+ /*
* if file does not exist, return. if file exists and -k, skip it
* quietly
*/
diff --git a/bin/pax/ftree.c b/bin/pax/ftree.c
index 2e55860fde1..ed813551520 100644
--- a/bin/pax/ftree.c
+++ b/bin/pax/ftree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftree.c,v 1.13 2001/02/09 23:01:00 millert Exp $ */
+/* $OpenBSD: ftree.c,v 1.14 2001/05/16 03:04:56 mickey Exp $ */
/* $NetBSD: ftree.c,v 1.4 1995/03/21 09:07:21 cgd Exp $ */
/*-
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)ftree.c 8.2 (Berkeley) 4/18/94";
#else
-static char rcsid[] = "$OpenBSD: ftree.c,v 1.13 2001/02/09 23:01:00 millert Exp $";
+static char rcsid[] = "$OpenBSD: ftree.c,v 1.14 2001/05/16 03:04:56 mickey Exp $";
#endif
#endif /* not lint */
@@ -313,7 +313,7 @@ ftree_arg()
if (fthead == NULL) {
/*
* the user didn't supply any args, get the file trees
- * to process from stdin;
+ * to process from stdin;
*/
if (fgets(farray[0], PAXPATHLEN+1, stdin) == NULL)
return(-1);
@@ -382,7 +382,7 @@ next_file(arcn)
/*
* ftree_sel() might have set the ftree_skip flag if the user has the
* -n option and a file was selected from this file arg tree. (-n says
- * only one member is matched for each pattern) ftree_skip being 1
+ * only one member is matched for each pattern) ftree_skip being 1
* forces us to go to the next arg now.
*/
if (ftree_skip) {
@@ -558,8 +558,7 @@ next_file(arcn)
/*
* copy file name, set file name length
*/
- arcn->nlen = l_strncpy(arcn->name, ftent->fts_path, sizeof(arcn->name) - 1);
- arcn->name[arcn->nlen] = '\0';
+ arcn->nlen = strlcpy(arcn->name, ftent->fts_path, sizeof(arcn->name));
arcn->org_name = ftent->fts_path;
return(0);
}
diff --git a/bin/pax/gen_subs.c b/bin/pax/gen_subs.c
index acbcc54fac6..967afe571d1 100644
--- a/bin/pax/gen_subs.c
+++ b/bin/pax/gen_subs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gen_subs.c,v 1.9 2001/02/12 13:51:15 danh Exp $ */
+/* $OpenBSD: gen_subs.c,v 1.10 2001/05/16 03:04:57 mickey Exp $ */
/* $NetBSD: gen_subs.c,v 1.5 1995/03/21 09:07:26 cgd Exp $ */
/*-
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)gen_subs.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: gen_subs.c,v 1.9 2001/02/12 13:51:15 danh Exp $";
+static char rcsid[] = "$OpenBSD: gen_subs.c,v 1.10 2001/05/16 03:04:57 mickey Exp $";
#endif
#endif /* not lint */
@@ -127,7 +127,7 @@ ls_list(arcn, now, fp)
if (strftime(f_date,DATELEN,timefrmt,localtime(&(sbp->st_mtime))) == 0)
f_date[0] = '\0';
(void)fprintf(fp, "%s%2u %-*.*s %-*.*s ", f_mode, sbp->st_nlink,
- NAME_WIDTH, UT_NAMESIZE, name_uid(sbp->st_uid, 1),
+ NAME_WIDTH, UT_NAMESIZE, name_uid(sbp->st_uid, 1),
NAME_WIDTH, UT_NAMESIZE, name_gid(sbp->st_gid, 1));
/*
@@ -164,7 +164,7 @@ ls_list(arcn, now, fp)
/*
* tty_ls()
- * print a short summary of file to tty.
+ * print a short summary of file to tty.
*/
#ifdef __STDC__
@@ -203,39 +203,6 @@ ls_tty(arcn)
}
/*
- * l_strncpy()
- * copy src to dest up to len chars (stopping at first '\0').
- * when src is shorter than len, pads to len with '\0'.
- * Return:
- * number of chars copied. (Note this is a real performance win over
- * doing a strncpy(), a strlen(), and then a possible memset())
- */
-
-#ifdef __STDC__
-int
-l_strncpy(register char *dest, register char *src, int len)
-#else
-int
-l_strncpy(dest, src, len)
- register char *dest;
- register char *src;
- int len;
-#endif
-{
- register char *stop;
- register char *start;
-
- stop = dest + len;
- start = dest;
- while ((dest < stop) && (*src != '\0'))
- *dest++ = *src++;
- len = dest - start;
- while (dest < stop)
- *dest++ = '\0';
- return(len);
-}
-
-/*
* asc_ul()
* convert hex/octal character string into a u_long. We do not have to
* check for overflow! (the headers in all supported formats are not large
@@ -283,7 +250,7 @@ asc_ul(str, len, base)
break;
}
} else {
- while ((str < stop) && (*str >= '0') && (*str <= '7'))
+ while ((str < stop) && (*str >= '0') && (*str <= '7'))
tval = (tval << 3) + (*str++ - '0');
}
return(tval);
@@ -397,7 +364,7 @@ asc_uqd(str, len, base)
break;
}
} else {
- while ((str < stop) && (*str >= '0') && (*str <= '7'))
+ while ((str < stop) && (*str >= '0') && (*str <= '7'))
tval = (tval << 3) + (*str++ - '0');
}
return(tval);
diff --git a/bin/pax/pat_rep.c b/bin/pax/pat_rep.c
index a93809f7436..447f5ba1daf 100644
--- a/bin/pax/pat_rep.c
+++ b/bin/pax/pat_rep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pat_rep.c,v 1.11 1997/09/01 18:29:56 deraadt Exp $ */
+/* $OpenBSD: pat_rep.c,v 1.12 2001/05/16 03:04:57 mickey Exp $ */
/* $NetBSD: pat_rep.c,v 1.4 1995/03/21 09:07:33 cgd Exp $ */
/*-
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)pat_rep.c 8.2 (Berkeley) 4/18/94";
#else
-static char rcsid[] = "$OpenBSD: pat_rep.c,v 1.11 1997/09/01 18:29:56 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: pat_rep.c,v 1.12 2001/05/16 03:04:57 mickey Exp $";
#endif
#endif /* not lint */
@@ -93,7 +93,7 @@ static int resub __P((regex_t *, regmatch_t *, char *, char *, char *));
* parses the -s replacement string; compiles the regular expression
* and stores the compiled value and it's replacement string together in
* replacement string list. Input to this function is of the form:
- * /old/new/pg
+ * /old/new/pg
* The first char in the string specifies the delimiter used by this
* replacement string. "Old" is a regular expression in "ed" format which
* is compiled by regcomp() and is applied to filenames. "new" is the
@@ -356,7 +356,7 @@ pat_sel(arcn)
/*
* we reach this point only when we allow a single selected match per
- * pattern, if the pattern matches a directory and we do not have -d
+ * pattern, if the pattern matches a directory and we do not have -d
* (dflag) we are done with this pattern. We may also be handed a file
* in the subtree of a directory. in that case when we are operating
* with -d, this pattern was already selected and we are done
@@ -446,7 +446,7 @@ pat_sel(arcn)
* this archive member is "selected" we process and mark the pattern as
* one which matched a selected archive member (see pat_sel())
* Return:
- * 0 if this archive member should be processed, 1 if it should be
+ * 0 if this archive member should be processed, 1 if it should be
* skipped and -1 if we are done with all patterns (and pax should quit
* looking for more members)
*/
@@ -523,7 +523,7 @@ pat_match(arcn)
/*
* fn_match()
* Return:
- * 0 if this archive member should be processed, 1 if it should be
+ * 0 if this archive member should be processed, 1 if it should be
* skipped and -1 if we are done with all patterns (and pax should quit
* looking for more members)
* Note: *pend may be changed to show where the prefix ends.
@@ -572,7 +572,7 @@ fn_match(pattern, string, pend)
case '*':
c = *pattern;
/*
- * Collapse multiple *'s.
+ * Collapse multiple *'s.
*/
while (c == '*')
c = *++pattern;
@@ -657,7 +657,7 @@ range_match(pattern, test)
* if we spot any file links to the old file name in the future, we will
* know exactly how to fix the file link.
* Return:
- * 0 continue to process file, 1 skip this file, -1 pax is finished
+ * 0 continue to process file, 1 skip this file, -1 pax is finished
*/
#ifdef __STDC__
@@ -816,8 +816,7 @@ tty_rename(arcn)
*/
tty_prnt("Processing continues, name changed to: %s\n", tmpname);
res = add_name(arcn->name, arcn->nlen, tmpname);
- arcn->nlen = l_strncpy(arcn->name, tmpname, sizeof(arcn->name) - 1);
- arcn->name[arcn->nlen] = '\0';
+ arcn->nlen = strlcpy(arcn->name, tmpname, sizeof(arcn->name));
if (res < 0)
return(-1);
return(0);
@@ -903,7 +902,7 @@ fix_path(or_name, or_len, dir_name, dir_len)
*or_len = len;
/*
- * enough space, shift
+ * enough space, shift
*/
while (src >= start)
*dest-- = *src--;
@@ -1097,8 +1096,7 @@ rep_name(name, nlen, prnt)
*/
if (*nname == '\0')
return(1);
- *nlen = l_strncpy(name, nname, PAXPATHLEN + 1);
- name[PAXPATHLEN] = '\0';
+ *nlen = strlcpy(name, nname, sizeof(nname));
}
return(0);
}
@@ -1107,7 +1105,7 @@ rep_name(name, nlen, prnt)
/*
* resub()
* apply the replacement to the matched expression. expand out the old
- * style ed(1) subexpression expansion.
+ * style ed(1) subexpression expansion.
* Return:
* -1 if error, or the number of characters added to the destination.
*/
@@ -1138,12 +1136,12 @@ resub(prog, src, dest, destend)
else if ((c == '\\') && (*spt >= '0') && (*spt <= '9'))
no = *spt++ - '0';
else {
- if ((c == '\\') && ((*spt == '\\') || (*spt == '&')))
- c = *spt++;
- *dpt++ = c;
+ if ((c == '\\') && ((*spt == '\\') || (*spt == '&')))
+ c = *spt++;
+ *dpt++ = c;
continue;
}
- if ((prog->startp[no] == NULL) || (prog->endp[no] == NULL) ||
+ if ((prog->startp[no] == NULL) || (prog->endp[no] == NULL) ||
((len = prog->endp[no] - prog->startp[no]) <= 0))
continue;
@@ -1152,9 +1150,8 @@ resub(prog, src, dest, destend)
* fail if we run out of space or the match string is damaged
*/
if (len > (destend - dpt))
- len = destend - dpt;
- if (l_strncpy(dpt, prog->startp[no], len) != len)
- return(-1);
+ return (-1);
+ strncpy(dpt, prog->startp[no], len);
dpt += len;
}
return(dpt - dest);
@@ -1165,7 +1162,7 @@ resub(prog, src, dest, destend)
/*
* resub()
* apply the replacement to the matched expression. expand out the old
- * style ed(1) subexpression expansion.
+ * style ed(1) subexpression expansion.
* Return:
* -1 if error, or the number of characters added to the destination.
*/
@@ -1209,12 +1206,12 @@ resub(rp, pm, src, dest, destend)
return(-1);
pmpt = pm + len;
} else {
- /*
+ /*
* Ordinary character, just copy it
*/
- if ((c == '\\') && ((*spt == '\\') || (*spt == '&')))
- c = *spt++;
- *dpt++ = c;
+ if ((c == '\\') && ((*spt == '\\') || (*spt == '&')))
+ c = *spt++;
+ *dpt++ = c;
continue;
}
@@ -1230,9 +1227,8 @@ resub(rp, pm, src, dest, destend)
* fail if we run out of space or the match string is damaged
*/
if (len > (destend - dpt))
- len = destend - dpt;
- if (l_strncpy(dpt, src + pmpt->rm_so, len) != len)
- return(-1);
+ return (-1);
+ strncpy(dpt, src + pmpt->rm_so, len);
dpt += len;
}
return(dpt - dest);
diff --git a/bin/pax/pax.c b/bin/pax/pax.c
index 60d27c6e00f..0251c33421e 100644
--- a/bin/pax/pax.c
+++ b/bin/pax/pax.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pax.c,v 1.16 2001/02/07 19:04:14 millert Exp $ */
+/* $OpenBSD: pax.c,v 1.17 2001/05/16 03:04:57 mickey Exp $ */
/* $NetBSD: pax.c,v 1.5 1996/03/26 23:54:20 mrg Exp $ */
/*-
@@ -48,7 +48,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)pax.c 8.2 (Berkeley) 4/18/94";
#else
-static char rcsid[] = "$OpenBSD: pax.c,v 1.16 2001/02/07 19:04:14 millert Exp $";
+static char rcsid[] = "$OpenBSD: pax.c,v 1.17 2001/05/16 03:04:57 mickey Exp $";
#endif
#endif /* not lint */
@@ -115,7 +115,7 @@ char *tempbase; /* basename of tempfile to use for mkstemp(3) */
/*
* PAX - Portable Archive Interchange
*
- * A utility to read, write, and write lists of the members of archive
+ * A utility to read, write, and write lists of the members of archive
* files and copy directory hierarchies. A variety of archive formats
* are supported (some are described in POSIX 1003.1 10.1):
*
@@ -131,7 +131,7 @@ char *tempbase; /* basename of tempfile to use for mkstemp(3) */
*
* 1 READ ENHANCEMENTS
* 1.1 Operations which read archives will continue to operate even when
- * processing archives which may be damaged, truncated, or fail to meet
+ * processing archives which may be damaged, truncated, or fail to meet
* format specs in several different ways. Damaged sections of archives
* are detected and avoided if possible. Attempts will be made to resync
* archive read operations even with badly damaged media.
@@ -146,7 +146,7 @@ char *tempbase; /* basename of tempfile to use for mkstemp(3) */
* 1.5 The user is notified whenever something is found during archive
* read operations which violates spec (but the read will continue).
* 1.6 Multiple archive volumes can be read and may span over different
- * archive devices
+ * archive devices
* 1.7 Rigidly restores all file attributes exactly as they are stored on the
* archive.
* 1.8 Modification change time ranges can be specified via multiple -T
@@ -172,7 +172,7 @@ char *tempbase; /* basename of tempfile to use for mkstemp(3) */
* these fields. This removes any restrictions on using these archive
* formats on large file systems.
* 2.5 Multiple archive volumes can be written and may span over different
- * archive devices
+ * archive devices
* 2.6 A archive volume record limit allows the user to specify the number
* of bytes stored on an archive volume. When reached the user is
* prompted for the next archive volume. This is specified with the
@@ -219,7 +219,7 @@ char *tempbase; /* basename of tempfile to use for mkstemp(3) */
* name modification (-Z)
*
* 4 GENERAL ENHANCEMENTS
- * 4.1 Internal structure is designed to isolate format dependent and
+ * 4.1 Internal structure is designed to isolate format dependent and
* independent functions. Formats are selected via a format driver table.
* This encourages the addition of new archive formats by only having to
* write those routines which id, read and write the archive header.
@@ -280,7 +280,7 @@ main(argc, argv)
return(exit_val);
/*
- * select a primary operation mode
+ * select a primary operation mode
*/
switch(act) {
case EXTRACT:
@@ -396,7 +396,7 @@ gen_init()
/*
* Handle posix locale
*
- * set user defines time printing format for -v option
+ * set user defines time printing format for -v option
*/
ltmfrmt = getenv("LC_TIME");
diff --git a/bin/pax/pax.h b/bin/pax/pax.h
index d049666dd35..9e80efd1102 100644
--- a/bin/pax/pax.h
+++ b/bin/pax/pax.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pax.h,v 1.10 2001/02/07 19:04:14 millert Exp $ */
+/* $OpenBSD: pax.h,v 1.11 2001/05/16 03:04:58 mickey Exp $ */
/* $NetBSD: pax.h,v 1.3 1995/03/21 09:07:41 cgd Exp $ */
/*-
@@ -66,7 +66,7 @@
#define DEFOP LIST /* if no flags default is to LIST */
/*
- * Device type of the current archive volume
+ * Device type of the current archive volume
*/
#define ISREG 0 /* regular file */
#define ISCHR 1 /* character device */
@@ -79,7 +79,7 @@
*
* The format specific routine table allows new archive formats to be quickly
* added. Overall pax operation is independent of the actual format used to
- * form the archive. Only those routines which deal directly with the archive
+ * form the archive. Only those routines which deal directly with the archive
* are tailored to the oddities of the specifc format. All other routines are
* independent of the archive format. Data flow in and out of the format
* dependent routines pass pointers to ARCHD structure (described below).
@@ -211,7 +211,7 @@ typedef struct {
#define PAX_FIF 7 /* fifo */
#define PAX_HLK 8 /* hard link */
#define PAX_HRG 9 /* hard link to a regular file */
-#define PAX_CTG 10 /* high performance file */
+#define PAX_CTG 10 /* high performance file */
} ARCHD;
/*
@@ -229,7 +229,7 @@ typedef struct oplist {
* General Macros
*/
#ifndef MIN
-#define MIN(a,b) (((a)<(b))?(a):(b))
+#define MIN(a,b) (((a)<(b))?(a):(b))
#endif
#define MAJOR(x) major(x)
#define MINOR(x) minor(x)
diff --git a/bin/pax/tables.c b/bin/pax/tables.c
index 5656f20bcb8..aee18b3af0e 100644
--- a/bin/pax/tables.c
+++ b/bin/pax/tables.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tables.c,v 1.12 2001/02/07 19:04:14 millert Exp $ */
+/* $OpenBSD: tables.c,v 1.13 2001/05/16 03:04:58 mickey Exp $ */
/* $NetBSD: tables.c,v 1.4 1995/03/21 09:07:45 cgd Exp $ */
/*-
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)tables.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: tables.c,v 1.12 2001/02/07 19:04:14 millert Exp $";
+static char rcsid[] = "$OpenBSD: tables.c,v 1.13 2001/05/16 03:04:58 mickey Exp $";
#endif
#endif /* not lint */
@@ -183,9 +183,8 @@ chk_lnk(arcn)
* handle hardlinks to regular files differently than
* other links.
*/
- arcn->ln_nlen = l_strncpy(arcn->ln_name, pt->name,
- sizeof(arcn->ln_name) - 1);
- arcn->ln_name[arcn->ln_nlen] = '\0';
+ arcn->ln_nlen = strlcpy(arcn->ln_name, pt->name,
+ sizeof(arcn->ln_name));
if (arcn->type == PAX_REG)
arcn->type = PAX_HRG;
else
@@ -658,8 +657,7 @@ sub_name(oname, onamelen, onamesize)
* found it, replace it with the new name
* and return (we know that oname has enough space)
*/
- *onamelen = l_strncpy(oname, pt->nname, onamesize - 1);
- oname[*onamelen] = '\0';
+ *onamelen = strlcpy(oname, pt->nname, onamesize);
return;
}
pt = pt->fow;
diff --git a/bin/pax/tables.h b/bin/pax/tables.h
index 1d9c8130ba6..c22945fb242 100644
--- a/bin/pax/tables.h
+++ b/bin/pax/tables.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tables.h,v 1.2 1996/06/23 14:20:43 deraadt Exp $ */
+/* $OpenBSD: tables.h,v 1.3 2001/05/16 03:04:58 mickey Exp $ */
/* $NetBSD: tables.h,v 1.3 1995/03/21 09:07:47 cgd Exp $ */
/*-
@@ -108,7 +108,7 @@ typedef struct namt {
* this table. (When the inode field in the archive header are too small, we
* remap the dev on writes to remove accidental collisions).
*
- * The list is hashed by device number using chain collision resolution. Off of
+ * The list is hashed by device number using chain collision resolution. Off of
* each DEVT are linked the various remaps for this device based on those bits
* in the inode which were truncated. For example if we are just remapping to
* avoid a device number during an update append, off the DEVT we would have
diff --git a/bin/pax/tar.c b/bin/pax/tar.c
index 92554494f31..a7486d68188 100644
--- a/bin/pax/tar.c
+++ b/bin/pax/tar.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tar.c,v 1.16 2001/01/04 20:31:25 todd Exp $ */
+/* $OpenBSD: tar.c,v 1.17 2001/05/16 03:04:59 mickey Exp $ */
/* $NetBSD: tar.c,v 1.5 1995/03/21 09:07:49 cgd Exp $ */
/*-
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94";
#else
-static char rcsid[] = "$OpenBSD: tar.c,v 1.16 2001/01/04 20:31:25 todd Exp $";
+static char rcsid[] = "$OpenBSD: tar.c,v 1.17 2001/05/16 03:04:59 mickey Exp $";
#endif
#endif /* not lint */
@@ -457,8 +457,7 @@ tar_rd(arcn, buf)
* copy out the name and values in the stat buffer
*/
hd = (HD_TAR *)buf;
- arcn->nlen = l_strncpy(arcn->name, hd->name, sizeof(arcn->name) - 1);
- arcn->name[arcn->nlen] = '\0';
+ arcn->nlen = strlcpy(arcn->name, hd->name, sizeof(arcn->name));
arcn->sb.st_mode = (mode_t)(asc_ul(hd->mode,sizeof(hd->mode),OCT) &
0xfff);
arcn->sb.st_uid = (uid_t)asc_ul(hd->uid, sizeof(hd->uid), OCT);
@@ -485,9 +484,8 @@ tar_rd(arcn, buf)
* the st_mode so -v printing will look correct.
*/
arcn->type = PAX_SLK;
- arcn->ln_nlen = l_strncpy(arcn->ln_name, hd->linkname,
- sizeof(arcn->ln_name) - 1);
- arcn->ln_name[arcn->ln_nlen] = '\0';
+ arcn->ln_nlen = strlcpy(arcn->ln_name, hd->linkname,
+ sizeof(arcn->ln_name));
arcn->sb.st_mode |= S_IFLNK;
break;
case LNKTYPE:
@@ -497,9 +495,8 @@ tar_rd(arcn, buf)
*/
arcn->type = PAX_HLK;
arcn->sb.st_nlink = 2;
- arcn->ln_nlen = l_strncpy(arcn->ln_name, hd->linkname,
- sizeof(arcn->ln_name) - 1);
- arcn->ln_name[arcn->ln_nlen] = '\0';
+ arcn->ln_nlen = strlcpy(arcn->ln_name, hd->linkname,
+ sizeof(arcn->ln_name));
/*
* no idea of what type this thing really points at, but
@@ -550,7 +547,7 @@ tar_rd(arcn, buf)
* strip off any trailing slash.
*/
if (*pt == '/') {
- *pt = '\0';
+ *pt = '\0';
--arcn->nlen;
}
return(0);
@@ -639,8 +636,7 @@ tar_wr(arcn)
* a header)
*/
hd = (HD_TAR *)hdblk;
- l_strncpy(hd->name, arcn->name, sizeof(hd->name) - 1);
- hd->name[sizeof(hd->name) - 1] = '\0';
+ strlcpy(hd->name, arcn->name, sizeof(hd->name));
arcn->pad = 0;
if (arcn->type == PAX_DIR) {
@@ -659,8 +655,7 @@ tar_wr(arcn)
* no data follows this file, so no pad
*/
hd->linkflag = SYMTYPE;
- l_strncpy(hd->linkname,arcn->ln_name, sizeof(hd->linkname) - 1);
- hd->linkname[sizeof(hd->linkname) - 1] = '\0';
+ strlcpy(hd->linkname,arcn->ln_name, sizeof(hd->linkname));
if (ul_oct((u_long)0L, hd->size, sizeof(hd->size), 1))
goto out;
} else if ((arcn->type == PAX_HLK) || (arcn->type == PAX_HRG)) {
@@ -668,8 +663,7 @@ tar_wr(arcn)
* no data follows this file, so no pad
*/
hd->linkflag = LNKTYPE;
- l_strncpy(hd->linkname,arcn->ln_name, sizeof(hd->linkname) - 1);
- hd->linkname[sizeof(hd->linkname) - 1] = '\0';
+ strlcpy(hd->linkname,arcn->ln_name, sizeof(hd->linkname));
if (ul_oct((u_long)0L, hd->size, sizeof(hd->size), 1))
goto out;
} else {
@@ -848,13 +842,12 @@ ustar_rd(arcn, buf)
*/
dest = arcn->name;
if (*(hd->prefix) != '\0') {
- cnt = l_strncpy(dest, hd->prefix, sizeof(arcn->name) - 2);
+ cnt = strlcpy(dest, hd->prefix, sizeof(arcn->name) - 1);
dest += cnt;
*dest++ = '/';
cnt++;
}
- arcn->nlen = cnt + l_strncpy(dest, hd->name, sizeof(arcn->name) - cnt);
- arcn->name[arcn->nlen] = '\0';
+ arcn->nlen = cnt + strlcpy(dest, hd->name, sizeof(arcn->name) - cnt);
/*
* follow the spec to the letter. we should only have mode bits, strip
@@ -945,9 +938,8 @@ ustar_rd(arcn, buf)
/*
* copy the link name
*/
- arcn->ln_nlen = l_strncpy(arcn->ln_name, hd->linkname,
- sizeof(arcn->ln_name) - 1);
- arcn->ln_name[arcn->ln_nlen] = '\0';
+ arcn->ln_nlen = strlcpy(arcn->ln_name, hd->linkname,
+ sizeof(arcn->ln_name));
break;
case CONTTYPE:
case AREGTYPE:
@@ -1028,7 +1020,8 @@ ustar_wr(arcn)
* occur, we remove the / and copy the first part to the prefix
*/
*pt = '\0';
- l_strncpy(hd->prefix, arcn->name, sizeof(hd->prefix) - 1);
+ strncpy(hd->prefix, arcn->name, sizeof(hd->prefix) - 1);
+ hd->prefix[sizeof(hd->prefix) - 1] = '\0';
*pt++ = '/';
} else
memset(hd->prefix, 0, sizeof(hd->prefix));
@@ -1037,7 +1030,7 @@ ustar_wr(arcn)
* copy the name part. this may be the whole path or the part after
* the prefix
*/
- l_strncpy(hd->name, pt, sizeof(hd->name) - 1);
+ strncpy(hd->name, pt, sizeof(hd->name) - 1);
hd->name[sizeof(hd->name) - 1] = '\0';
/*
@@ -1081,7 +1074,7 @@ ustar_wr(arcn)
hd->typeflag = SYMTYPE;
else
hd->typeflag = LNKTYPE;
- l_strncpy(hd->linkname,arcn->ln_name, sizeof(hd->linkname) - 1);
+ strncpy(hd->linkname,arcn->ln_name, sizeof(hd->linkname) - 1);
hd->linkname[sizeof(hd->linkname) - 1] = '\0';
memset(hd->devmajor, 0, sizeof(hd->devmajor));
memset(hd->devminor, 0, sizeof(hd->devminor));
@@ -1115,8 +1108,8 @@ ustar_wr(arcn)
break;
}
- l_strncpy(hd->magic, TMAGIC, TMAGLEN);
- l_strncpy(hd->version, TVERSION, TVERSLEN);
+ strncpy(hd->magic, TMAGIC, TMAGLEN);
+ strncpy(hd->version, TVERSION, TVERSLEN);
/*
* set the remaining fields. Some versions want all 16 bits of mode
@@ -1127,8 +1120,8 @@ ustar_wr(arcn)
ul_oct((u_long)arcn->sb.st_gid, hd->gid, sizeof(hd->gid), 3) ||
ul_oct((u_long)arcn->sb.st_mtime,hd->mtime,sizeof(hd->mtime),3))
goto out;
- l_strncpy(hd->uname,name_uid(arcn->sb.st_uid, 0),sizeof(hd->uname));
- l_strncpy(hd->gname,name_gid(arcn->sb.st_gid, 0),sizeof(hd->gname));
+ strncpy(hd->uname,name_uid(arcn->sb.st_uid, 0),sizeof(hd->uname));
+ strncpy(hd->gname,name_gid(arcn->sb.st_gid, 0),sizeof(hd->gname));
/*
* calculate and store the checksum write the header to the archive
@@ -1147,7 +1140,7 @@ ustar_wr(arcn)
return(1);
out:
- /*
+ /*
* header field is out of range
*/
paxwarn(1, "Ustar header field is too small for %s", arcn->org_name);