Fix a bunch of typos and a couple of whitespace nits.
Helped by: codespell and vim's spellchecker
This commit is contained in:
parent
5179964e55
commit
1fb4642784
@ -204,7 +204,7 @@ ar_open(const char *name)
|
||||
/*
|
||||
* set default blksz on read. APPNDs writes rdblksz on the last volume
|
||||
* On all new archive volumes, we shift to wrblksz (if the user
|
||||
* specified one, otherwize we will continue to use rdblksz). We
|
||||
* specified one, otherwise we will continue to use rdblksz). We
|
||||
* must to set blocksize based on what kind of device the archive is
|
||||
* stored.
|
||||
*/
|
||||
@ -381,7 +381,7 @@ ar_close(void)
|
||||
|
||||
/*
|
||||
* If we have not determined the format yet, we just say how many bytes
|
||||
* we have skipped over looking for a header to id. there is no way we
|
||||
* we have skipped over looking for a header to id. There is no way we
|
||||
* could have written anything yet.
|
||||
*/
|
||||
if (frmt == NULL) {
|
||||
@ -595,7 +595,7 @@ ar_read(char *buf, int cnt)
|
||||
* Return:
|
||||
* Number of bytes written. 0 indicates end of volume reached and with no
|
||||
* flaws (as best that can be detected). A -1 indicates an unrecoverable
|
||||
* error in the archive occured.
|
||||
* error in the archive occurred.
|
||||
*/
|
||||
|
||||
int
|
||||
@ -679,7 +679,7 @@ ar_write(char *buf, int bsz)
|
||||
* if this is a block aligned archive format, we may have a bad archive
|
||||
* if the format wants the header to start at a BLKMULT boundary. While
|
||||
* we can deal with the mis-aligned data, it violates spec and other
|
||||
* archive readers will likely fail. if the format is not block
|
||||
* archive readers will likely fail. If the format is not block
|
||||
* aligned, the user may be lucky (and the archive is ok).
|
||||
*/
|
||||
if (res >= 0) {
|
||||
@ -794,7 +794,7 @@ ar_rdsync(void)
|
||||
|
||||
/*
|
||||
* ar_fow()
|
||||
* Move the I/O position within the archive foward the specified number of
|
||||
* Move the I/O position within the archive forward the specified number of
|
||||
* bytes as supported by the device. If we cannot move the requested
|
||||
* number of bytes, return the actual number of bytes moved in skipped.
|
||||
* Return:
|
||||
@ -813,7 +813,7 @@ ar_fow(off_t sksz, off_t *skipped)
|
||||
return(0);
|
||||
|
||||
/*
|
||||
* we cannot move foward at EOF or error
|
||||
* we cannot move forward at EOF or error
|
||||
*/
|
||||
if (lstrval <= 0)
|
||||
return(lstrval);
|
||||
@ -822,7 +822,7 @@ ar_fow(off_t sksz, off_t *skipped)
|
||||
* Safer to read forward on devices where it is hard to find the end of
|
||||
* the media without reading to it. With tapes we cannot be sure of the
|
||||
* number of physical blocks to skip (we do not know physical block
|
||||
* size at this point), so we must only read foward on tapes!
|
||||
* size at this point), so we must only read forward on tapes!
|
||||
*/
|
||||
if (artyp != ISREG)
|
||||
return(0);
|
||||
@ -907,7 +907,7 @@ ar_rev(off_t sksz)
|
||||
|
||||
/*
|
||||
* we may try to go backwards past the start when the archive
|
||||
* is only a single record. If this hapens and we are on a
|
||||
* is only a single record. If this happens and we are on a
|
||||
* multi volume archive, we need to go to the end of the
|
||||
* previous volume and continue our movement backwards from
|
||||
* there.
|
||||
@ -1046,7 +1046,7 @@ get_phys(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* read foward to the file mark, then back up in front of the filemark
|
||||
* read forward to the file mark, then back up in front of the filemark
|
||||
* (this is a bit paranoid, but should be safe to do).
|
||||
*/
|
||||
while ((res = read(arfd, scbuf, sizeof(scbuf))) > 0)
|
||||
|
@ -854,7 +854,7 @@ copy(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Non standard -Y and -Z flag. When the exisiting file is
|
||||
* Non standard -Y and -Z flag. When the existing file is
|
||||
* same age or newer skip
|
||||
*/
|
||||
if ((Yflag || Zflag) && ((lstat(arcn->name, &sb) == 0))) {
|
||||
@ -1096,7 +1096,7 @@ next_head(ARCHD *arcn)
|
||||
}
|
||||
|
||||
/*
|
||||
* ok got a valid header, check for trailer if format encodes it in the
|
||||
* ok got a valid header, check for trailer if format encodes it in
|
||||
* the header.
|
||||
*/
|
||||
if (frmt->inhead && ((*frmt->trail_cpio)(arcn) == 0)) {
|
||||
|
@ -145,7 +145,7 @@ rd_start(void)
|
||||
}
|
||||
if (wrblksz % BLKMULT) {
|
||||
paxwarn(1, "Write block size %d is not a %d byte multiple",
|
||||
wrblksz, BLKMULT);
|
||||
wrblksz, BLKMULT);
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
@ -182,13 +182,13 @@ cp_start(void)
|
||||
* the start of the header of the first file added to the archive. The
|
||||
* format specific end read function tells us how many bytes to move
|
||||
* backwards in the archive to be positioned BEFORE the trailer. Two
|
||||
* different postions have to be adjusted, the O.S. file offset (e.g. the
|
||||
* different positions have to be adjusted, the O.S. file offset (e.g. the
|
||||
* position of the tape head) and the write point within the data we have
|
||||
* stored in the read (soon to become write) buffer. We may have to move
|
||||
* back several records (the number depends on the size of the archive
|
||||
* record and the size of the format trailer) to read up the record where
|
||||
* the first byte of the trailer is recorded. Trailers may span (and
|
||||
* overlap) record boundries.
|
||||
* overlap) record boundaries.
|
||||
* We first calculate which record has the first byte of the trailer. We
|
||||
* move the OS file offset back to the start of this record and read it
|
||||
* up. We set the buffer write pointer to be at this byte (the byte where
|
||||
@ -196,10 +196,10 @@ cp_start(void)
|
||||
* start of this record so a flush of this buffer will replace the record
|
||||
* in the archive.
|
||||
* A major problem is rewriting this last record. For archives stored
|
||||
* on disk files, this is trival. However, many devices are really picky
|
||||
* on disk files, this is trivial. However, many devices are really picky
|
||||
* 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
|
||||
* so it may not be feasible to append archives stored on all types of
|
||||
* devices.
|
||||
* Return:
|
||||
* 0 for success, -1 for failure
|
||||
@ -365,7 +365,7 @@ rd_sync(void)
|
||||
* pback()
|
||||
* push the data used during the archive id phase back into the I/O
|
||||
* buffer. This is required as we cannot be sure that the header does NOT
|
||||
* overlap a block boundry (as in the case we are trying to recover a
|
||||
* overlap a block boundary (as in the case we are trying to recover a
|
||||
* flawed archived). This was not designed to be used for any other
|
||||
* purpose. (What software engineering, HA!)
|
||||
* WARNING: do not even THINK of pback greater than BLKMULT, unless the
|
||||
@ -382,7 +382,7 @@ pback(char *pt, int cnt)
|
||||
|
||||
/*
|
||||
* rd_skip()
|
||||
* skip foward in the archive during an archive read. Used to get quickly
|
||||
* skip forward in the archive during an archive read. Used to get quickly
|
||||
* past file data and padding for files the user did NOT select.
|
||||
* Return:
|
||||
* 0 if ok, -1 failure, and 1 when EOF on the archive volume was detected.
|
||||
@ -396,7 +396,7 @@ rd_skip(off_t skcnt)
|
||||
off_t skipped = 0;
|
||||
|
||||
/*
|
||||
* consume what data we have in the buffer. If we have to move foward
|
||||
* consume what data we have in the buffer. If we have to move forward
|
||||
* whole records, we call the low level skip function to see if we can
|
||||
* move within the archive without doing the expensive reads on data we
|
||||
* do not want.
|
||||
@ -453,7 +453,7 @@ rd_skip(off_t skcnt)
|
||||
* 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
|
||||
* lot easier to recover if the archive is damaged. zero paddding SHOULD
|
||||
* lot easier to recover if the archive is damaged. zero padding SHOULD
|
||||
* BE a requirement....
|
||||
*/
|
||||
|
||||
@ -530,7 +530,7 @@ rd_wrbuf(char *in, int cpcnt)
|
||||
/*
|
||||
* read error, return what we got (or the error if
|
||||
* no data was copied). The caller must know that an
|
||||
* error occured and has the best knowledge what to
|
||||
* error occurred and has the best knowledge what to
|
||||
* do with it
|
||||
*/
|
||||
if ((res = cpcnt - incnt) > 0)
|
||||
@ -584,7 +584,7 @@ wr_skip(off_t skcnt)
|
||||
|
||||
/*
|
||||
* wr_rdfile()
|
||||
* fill write buffer with the contents of a file. We are passed an open
|
||||
* fill write buffer with the contents of a file. We are passed an open
|
||||
* file descriptor to the file and the archive structure that describes the
|
||||
* file we are storing. The variable "left" is modified to contain the
|
||||
* number of bytes of the file we were NOT able to write to the archive.
|
||||
@ -671,7 +671,7 @@ rd_wrfile(ARCHD *arcn, int ofd, off_t *left)
|
||||
int isem = 1;
|
||||
int rem;
|
||||
int sz = MINFBSZ;
|
||||
struct stat sb;
|
||||
struct stat sb;
|
||||
u_long crc = 0L;
|
||||
|
||||
/*
|
||||
@ -884,7 +884,7 @@ buf_flush(int bufcnt)
|
||||
|
||||
/*
|
||||
* if we have reached the user specified byte count for each archive
|
||||
* volume, prompt for the next volume. (The non-standrad -R flag).
|
||||
* volume, prompt for the next volume. (The non-standard -R flag).
|
||||
* NOTE: If the wrlimit is smaller than wrcnt, we will always write
|
||||
* at least one record. We always round limit UP to next blocksize.
|
||||
*/
|
||||
@ -944,7 +944,7 @@ buf_flush(int bufcnt)
|
||||
} else if (cnt > 0) {
|
||||
/*
|
||||
* Oh drat we got a partial write!
|
||||
* if format doesnt care about alignment let it go,
|
||||
* if format doesn't care about alignment let it go,
|
||||
* we warned the user in ar_write().... but this means
|
||||
* the last record on this volume violates pax spec....
|
||||
*/
|
||||
|
@ -627,7 +627,7 @@ vcpio_rd(ARCHD *arcn, char *buf)
|
||||
return(-1);
|
||||
|
||||
/*
|
||||
* skip padding. header + filename is aligned to 4 byte boundries
|
||||
* skip padding. header + filename is aligned to 4 byte boundaries
|
||||
*/
|
||||
if (rd_skip((off_t)(VCPIO_PAD(sizeof(HD_VCPIO) + nsz))) < 0)
|
||||
return(-1);
|
||||
@ -942,7 +942,7 @@ bcpio_rd(ARCHD *arcn, char *buf)
|
||||
return(-1);
|
||||
|
||||
/*
|
||||
* header + file name are aligned to 2 byte boundries, skip if needed
|
||||
* 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);
|
||||
@ -989,8 +989,8 @@ bcpio_endrd(void)
|
||||
* bcpio_wr()
|
||||
* copy the data in the ARCHD to buffer in old binary cpio format
|
||||
* There is a real chance of field overflow with this critter. So we
|
||||
* always check the conversion is ok. nobody in his their right mind
|
||||
* should write an achive in this format...
|
||||
* always check that the conversion is ok. nobody in their right mind
|
||||
* should write an archive in this format...
|
||||
* Return
|
||||
* 0 if file has data to be written after the header, 1 if file has NO
|
||||
* data to write after the header, -1 if archive write failed
|
||||
|
@ -84,9 +84,9 @@ file_creat(ARCHD *arcn)
|
||||
* works. We have to take special handling when the file does exist. To
|
||||
* detect this, we use O_EXCL. For example when trying to create a
|
||||
* file and a character device or fifo exists with the same name, we
|
||||
* can accidently open the device by mistake (or block waiting to open)
|
||||
* If we find that the open has failed, then figure spend the effort to
|
||||
* figure out why. This strategy was found to have better average
|
||||
* can accidentally open the device by mistake (or block waiting to
|
||||
* open). If we find that the open has failed, then spend the effort
|
||||
* to figure out why. This strategy was found to have better average
|
||||
* performance in common use than checking the file (and the path)
|
||||
* first with lstat.
|
||||
*/
|
||||
@ -559,7 +559,7 @@ chk_path( char *name, uid_t st_uid, gid_t st_gid)
|
||||
|
||||
for(;;) {
|
||||
/*
|
||||
* work foward from the first / and check each part of the path
|
||||
* work forward from the first / and check each part of the path
|
||||
*/
|
||||
spt = strchr(spt, '/');
|
||||
if (spt == NULL)
|
||||
@ -600,7 +600,7 @@ chk_path( char *name, uid_t st_uid, gid_t st_gid)
|
||||
(void)set_ids(name, st_uid, st_gid);
|
||||
|
||||
/*
|
||||
* make sure the user doen't have some strange umask that
|
||||
* make sure the user doesn't have some strange umask that
|
||||
* causes this newly created directory to be unusable. We fix
|
||||
* the modes and restore them back to the creation default at
|
||||
* the end of pax
|
||||
@ -716,11 +716,11 @@ set_pmode(char *fnm, mode_t mode)
|
||||
* uses lseek whenever it detects the input data is all 0 within that
|
||||
* file block. In more detail, the strategy is as follows:
|
||||
* While the input is all zero keep doing an lseek. Keep track of when we
|
||||
* pass over file block boundries. Only write when we hit a non zero
|
||||
* pass over file block boundaries. Only write when we hit a non zero
|
||||
* input. once we have written a file block, we continue to write it to
|
||||
* the end (we stop looking at the input). When we reach the start of the
|
||||
* next file block, start checking for zero blocks again. Working on file
|
||||
* block boundries significantly reduces the overhead when copying files
|
||||
* block boundaries significantly reduces the overhead when copying files
|
||||
* that are NOT very sparse. This overhead (when compared to a write) is
|
||||
* almost below the measurement resolution on many systems. Without it,
|
||||
* files with holes cannot be safely copied. It does has a side effect as
|
||||
@ -923,7 +923,7 @@ set_crc(ARCHD *arcn, int fd)
|
||||
|
||||
/*
|
||||
* safety check. we want to avoid archiving files that are active as
|
||||
* they can create inconsistant archive copies.
|
||||
* they can create inconsistent archive copies.
|
||||
*/
|
||||
if (cpcnt != arcn->sb.st_size)
|
||||
paxwarn(1, "File changed size %s", arcn->org_name);
|
||||
|
@ -101,8 +101,8 @@ ftree_start(void)
|
||||
/*
|
||||
* optional user flags that effect file traversal
|
||||
* -H command line symlink follow only (half follow)
|
||||
* -L follow sylinks (logical)
|
||||
* -P do not follow sylinks (physical). This is the default.
|
||||
* -L follow symlinks (logical)
|
||||
* -P do not follow symlinks (physical). This is the default.
|
||||
* -X do not cross over mount points
|
||||
* -t preserve access times on files read.
|
||||
* -n select only the first member of a file tree when a match is found
|
||||
|
@ -887,7 +887,7 @@ tar_options(int argc, char **argv)
|
||||
sawpat = 1;
|
||||
}
|
||||
/*
|
||||
* if patterns were added, we are doing chdir()
|
||||
* if patterns were added, we are doing chdir()
|
||||
* on a file-by-file basis, else, just one
|
||||
* global chdir (if any) after opening input.
|
||||
*/
|
||||
|
@ -397,7 +397,7 @@ pat_sel(ARCHD *arcn)
|
||||
/*
|
||||
* should never happen....
|
||||
*/
|
||||
paxwarn(1, "Pattern list inconsistant");
|
||||
paxwarn(1, "Pattern list inconsistent");
|
||||
return(-1);
|
||||
}
|
||||
*ppt = pt->fow;
|
||||
|
@ -372,7 +372,7 @@ gen_init(void)
|
||||
/*
|
||||
* signal handling to reset stored directory times and modes. Since
|
||||
* we deal with broken pipes via failed writes we ignore it. We also
|
||||
* deal with any file size limit thorugh failed writes. Cpu time
|
||||
* deal with any file size limit thorough failed writes. Cpu time
|
||||
* limits are caught and a cleanup is forced.
|
||||
*/
|
||||
if ((sigemptyset(&s_mask) < 0) || (sigaddset(&s_mask, SIGTERM) < 0) ||
|
||||
|
@ -376,7 +376,7 @@ trng_add(char *str)
|
||||
}
|
||||
|
||||
/*
|
||||
* by default we only will check file mtime, but usee can specify
|
||||
* by default we only will check file mtime, but the user can specify
|
||||
* mtime, ctime (inode change time) or both.
|
||||
*/
|
||||
if ((flgpt == NULL) || (*flgpt == '\0'))
|
||||
|
@ -209,7 +209,7 @@ chk_lnk(ARCHD *arcn)
|
||||
* purg_lnk
|
||||
* remove reference for a file that we may have added to the data base as
|
||||
* a potential source for hard links. We ended up not using the file, so
|
||||
* we do not want to accidently point another file at it later on.
|
||||
* we do not want to accidentally point another file at it later on.
|
||||
*/
|
||||
|
||||
void
|
||||
@ -306,14 +306,14 @@ lnk_end(void)
|
||||
* An append with an -u must read the archive and store the modification time
|
||||
* for every file on that archive before starting the write phase. It is clear
|
||||
* that this is one HUGE database. To save memory space, the actual file names
|
||||
* are stored in a scatch file and indexed by an in memory hash table. The
|
||||
* are stored in a scratch file and indexed by an in memory hash table. The
|
||||
* hash table is indexed by hashing the file path. The nodes in the table store
|
||||
* the length of the filename and the lseek offset within the scratch file
|
||||
* where the actual name is stored. Since there are never any deletions to this
|
||||
* table, fragmentation of the scratch file is never an issue. Lookups seem to
|
||||
* not exhibit any locality at all (files in the database are rarely
|
||||
* looked up more than once...). So caching is just a waste of memory. The
|
||||
* only limitation is the amount of scatch file space available to store the
|
||||
* only limitation is the amount of scratch file space available to store the
|
||||
* path names.
|
||||
*/
|
||||
|
||||
|
@ -291,7 +291,7 @@ tar_chksm(char *blk, int len)
|
||||
/*
|
||||
* tar_id()
|
||||
* determine if a block given to us is a valid tar header (and not a USTAR
|
||||
* header). We have to be on the lookout for those pesky blocks of all
|
||||
* header). We have to be on the lookout for those pesky blocks of all
|
||||
* zero's.
|
||||
* Return:
|
||||
* 0 if a tar header, -1 otherwise
|
||||
|
Loading…
Reference in New Issue
Block a user