1 /* $OpenBSD: file_subs.c,v 1.33 2013/04/16 18:06:35 millert Exp $ */
2 /* $NetBSD: file_subs.c,v 1.4 1995/03/21 09:07:18 cgd Exp $ */
5 * Copyright (c) 1992 Keith Muller.
6 * Copyright (c) 1992, 1993
7 * The Regents of the University of California. All rights reserved.
9 * This code is derived from software contributed to Berkeley by
10 * Keith Muller of the University of California, San Diego.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 #include <sys/param.h>
53 mk_link(char *, struct stat
*, char *, int);
56 * routines that deal with file operations such as: creating, removing;
57 * and setting access modes, uid/gid and times of files
60 #define FILEBITS (S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
61 #define SETBITS (S_ISUID | S_ISGID)
62 #define ABITS (FILEBITS | SETBITS)
66 * Create and open a file.
68 * file descriptor or -1 for failure
72 file_creat(ARCHD
*arcn
)
79 * Assume file doesn't exist, so just try to create it, most times this
80 * works. We have to take special handling when the file does exist. To
81 * detect this, we use O_EXCL. For example when trying to create a
82 * file and a character device or fifo exists with the same name, we
83 * can accidently open the device by mistake (or block waiting to open).
84 * If we find that the open has failed, then spend the effort to
85 * figure out why. This strategy was found to have better average
86 * performance in common use than checking the file (and the path)
89 file_mode
= arcn
->sb
.st_mode
& FILEBITS
;
90 if ((fd
= open(arcn
->name
, O_WRONLY
| O_CREAT
| O_TRUNC
| O_EXCL
,
95 * the file seems to exist. First we try to get rid of it (found to be
96 * the second most common failure when traced). If this fails, only
97 * then we go to the expense to check and create the path to the file
99 if (unlnk_exist(arcn
->name
, arcn
->type
) != 0)
104 * try to open it again, if this fails, check all the nodes in
105 * the path and give it a final try. if chk_path() finds that
106 * it cannot fix anything, we will skip the last attempt
108 if ((fd
= open(arcn
->name
, O_WRONLY
| O_CREAT
| O_TRUNC
,
112 if (nodirs
|| chk_path(arcn
->name
,arcn
->sb
.st_uid
,arcn
->sb
.st_gid
) < 0) {
113 syswarn(1, oerrno
, "Unable to create %s", arcn
->name
);
122 * Close file descriptor to a file just created by pax. Sets modes,
123 * ownership and times as required.
125 * 0 for success, -1 for failure
129 file_close(ARCHD
*arcn
, int fd
)
137 * set owner/groups first as this may strip off mode bits we want
138 * then set file permission modes. Then set file access and
139 * modification times.
142 res
= fset_ids(arcn
->name
, fd
, arcn
->sb
.st_uid
,
146 * IMPORTANT SECURITY NOTE:
147 * if not preserving mode or we cannot set uid/gid, then PROHIBIT
151 arcn
->sb
.st_mode
&= ~(SETBITS
);
153 fset_pmode(arcn
->name
, fd
, arcn
->sb
.st_mode
);
154 if (patime
|| pmtime
)
155 fset_ftime(arcn
->name
, fd
, arcn
->sb
.st_mtime
,
156 arcn
->sb
.st_atime
, 0);
158 syswarn(0, errno
, "Unable to close file descriptor on %s",
164 * Create a hard link to arcn->ln_name from arcn->name. arcn->ln_name
167 * 0 if ok, -1 otherwise
171 lnk_creat(ARCHD
*arcn
)
176 * we may be running as root, so we have to be sure that link target
177 * is not a directory, so we lstat and check
179 if (lstat(arcn
->ln_name
, &sb
) < 0) {
180 syswarn(1,errno
,"Unable to link to %s from %s", arcn
->ln_name
,
185 if (S_ISDIR(sb
.st_mode
)) {
186 paxwarn(1, "A hard link to the directory %s is not allowed",
191 return(mk_link(arcn
->ln_name
, &sb
, arcn
->name
, 0));
196 * Create a hard link to arcn->org_name from arcn->name. Only used in copy
197 * with the -l flag. No warning or error if this does not succeed (we will
198 * then just create the file)
200 * 1 if copy() should try to create this file node
201 * 0 if cross_lnk() ok, -1 for fatal flaw (like linking to self).
205 cross_lnk(ARCHD
*arcn
)
208 * try to make a link to original file (-l flag in copy mode). make
209 * sure we do not try to link to directories in case we are running as
210 * root (and it might succeed).
212 if (arcn
->type
== PAX_DIR
)
214 return(mk_link(arcn
->org_name
, &(arcn
->sb
), arcn
->name
, 1));
219 * In copy mode if we are not trying to make hard links between the src
220 * and destinations, make sure we are not going to overwrite ourselves by
221 * accident. This slows things down a little, but we have to protect all
222 * those people who make typing errors.
224 * 1 the target does not exist, go ahead and copy
225 * 0 skip it file exists (-k) or may be the same as source file
229 chk_same(ARCHD
*arcn
)
234 * if file does not exist, return. if file exists and -k, skip it
237 if (lstat(arcn
->name
, &sb
) < 0)
243 * better make sure the user does not have src == dest by mistake
245 if ((arcn
->sb
.st_dev
== sb
.st_dev
) && (arcn
->sb
.st_ino
== sb
.st_ino
)) {
246 paxwarn(1, "Unable to copy %s, file would overwrite itself",
255 * try to make a hard link between two files. if ign set, we do not
258 * 0 if successful (or we are done with this file but no error, such as
259 * finding the from file exists and the user has set -k).
260 * 1 when ign was set to indicates we could not make the link but we
261 * should try to copy/extract the file as that might work (and is an
262 * allowed option). -1 an error occurred.
266 mk_link(char *to
, struct stat
*to_sb
, char *from
, int ign
)
272 * if from file exists, it has to be unlinked to make the link. If the
273 * file exists and -k is set, skip it quietly
275 if (lstat(from
, &sb
) == 0) {
280 * make sure it is not the same file, protect the user
282 if ((to_sb
->st_dev
==sb
.st_dev
)&&(to_sb
->st_ino
== sb
.st_ino
)) {
283 paxwarn(1, "Unable to link file %s to itself", to
);
288 * try to get rid of the file, based on the type
290 if (S_ISDIR(sb
.st_mode
)) {
291 if (rmdir(from
) < 0) {
292 syswarn(1, errno
, "Unable to remove %s", from
);
295 } else if (unlink(from
) < 0) {
297 syswarn(1, errno
, "Unable to remove %s", from
);
305 * from file is gone (or did not exist), try to make the hard link.
306 * if it fails, check the path and try it again (if chk_path() says to
310 if (link(to
, from
) == 0)
313 if (!nodirs
&& chk_path(from
, to_sb
->st_uid
, to_sb
->st_gid
) == 0)
316 syswarn(1, oerrno
, "Could not link to %s from %s", to
,
324 * all right the link was made
331 * create an entry in the file system (other than a file or hard link).
332 * If successful, sets uid/gid modes and times as required.
334 * 0 if ok, -1 otherwise
338 node_creat(ARCHD
*arcn
)
346 char target
[MAXPATHLEN
];
347 char *nm
= arcn
->name
;
351 * create node based on type, if that fails try to unlink the node and
352 * try again. finally check the path and try again. As noted in the
353 * file and link creation routines, this method seems to exhibit the
354 * best performance in general use workloads.
356 file_mode
= arcn
->sb
.st_mode
& FILEBITS
;
359 switch (arcn
->type
) {
362 * If -h (or -L) was given in tar-mode, follow the
363 * potential symlink chain before trying to create the
366 if (strcmp(NM_TAR
, argv0
) == 0 && Lflag
) {
367 while (lstat(nm
, &sb
) == 0 &&
368 S_ISLNK(sb
.st_mode
)) {
369 len
= readlink(nm
, target
,
373 "cannot follow symlink %s in chain for %s",
382 res
= mkdir(nm
, file_mode
);
389 file_mode
|= S_IFCHR
;
390 res
= mknod(nm
, file_mode
, arcn
->sb
.st_rdev
);
393 file_mode
|= S_IFBLK
;
394 res
= mknod(nm
, file_mode
, arcn
->sb
.st_rdev
);
397 res
= mkfifo(nm
, file_mode
);
401 * Skip sockets, operation has no meaning under BSD
404 "%s skipped. Sockets cannot be copied or extracted",
408 res
= symlink(arcn
->ln_name
, nm
);
416 * we should never get here
418 paxwarn(0, "%s has an unknown file type, skipping",
424 * if we were able to create the node break out of the loop,
425 * otherwise try to unlink the node and try again. if that
426 * fails check the full path and try a final time.
432 * we failed to make the node
435 if ((ign
= unlnk_exist(nm
, arcn
->type
)) < 0)
441 if (nodirs
|| chk_path(nm
,arcn
->sb
.st_uid
,arcn
->sb
.st_gid
) < 0) {
442 syswarn(1, oerrno
, "Could not create: %s", nm
);
448 * we were able to create the node. set uid/gid, modes and times
451 res
= ((arcn
->type
== PAX_SLK
) ?
452 set_lids(nm
, arcn
->sb
.st_uid
, arcn
->sb
.st_gid
) :
453 set_ids(nm
, arcn
->sb
.st_uid
, arcn
->sb
.st_gid
));
458 * symlinks are done now.
460 if (arcn
->type
== PAX_SLK
)
464 * IMPORTANT SECURITY NOTE:
465 * if not preserving mode or we cannot set uid/gid, then PROHIBIT any
469 arcn
->sb
.st_mode
&= ~(SETBITS
);
471 set_pmode(nm
, arcn
->sb
.st_mode
);
473 if (arcn
->type
== PAX_DIR
&& strcmp(NM_CPIO
, argv0
) != 0) {
475 * Dirs must be processed again at end of extract to set times
476 * and modes to agree with those stored in the archive. However
477 * to allow extract to continue, we may have to also set owner
478 * rights. This allows nodes in the archive that are children
479 * of this directory to be extracted without failure. Both time
480 * and modes will be fixed after the entire archive is read and
483 if (access(nm
, R_OK
| W_OK
| X_OK
) < 0) {
484 if (lstat(nm
, &sb
) < 0) {
485 syswarn(0, errno
,"Could not access %s (stat)",
487 set_pmode(nm
,file_mode
| S_IRWXU
);
490 * We have to add rights to the dir, so we make
491 * sure to restore the mode. The mode must be
492 * restored AS CREATED and not as stored if
496 ((sb
.st_mode
& FILEBITS
) | S_IRWXU
));
498 arcn
->sb
.st_mode
= sb
.st_mode
;
502 * we have to force the mode to what was set here,
503 * since we changed it from the default as created.
505 add_dir(nm
, &(arcn
->sb
), 1);
506 } else if (pmode
|| patime
|| pmtime
)
507 add_dir(nm
, &(arcn
->sb
), 0);
510 if (patime
|| pmtime
)
511 set_ftime(nm
, arcn
->sb
.st_mtime
, arcn
->sb
.st_atime
, 0);
517 * Remove node from file system with the specified name. We pass the type
518 * of the node that is going to replace it. When we try to create a
519 * directory and find that it already exists, we allow processing to
520 * continue as proper modes etc will always be set for it later on.
522 * 0 is ok to proceed, no file with the specified name exists
523 * -1 we were unable to remove the node, or we should not remove it (-k)
524 * 1 we found a directory and we were going to create a directory.
528 unlnk_exist(char *name
, int type
)
533 * the file does not exist, or -k we are done
535 if (lstat(name
, &sb
) < 0)
540 if (S_ISDIR(sb
.st_mode
)) {
542 * try to remove a directory, if it fails and we were going to
543 * create a directory anyway, tell the caller (return a 1)
545 if (rmdir(name
) < 0) {
548 syswarn(1,errno
,"Unable to remove directory %s", name
);
555 * try to get rid of all non-directory type nodes
557 if (unlink(name
) < 0) {
558 syswarn(1, errno
, "Could not unlink %s", name
);
566 * We were trying to create some kind of node in the file system and it
567 * failed. chk_path() makes sure the path up to the node exists and is
568 * writeable. When we have to create a directory that is missing along the
569 * path somewhere, the directory we create will be set to the same
570 * uid/gid as the file has (when uid and gid are being preserved).
571 * NOTE: this routine is a real performance loss. It is only used as a
572 * last resort when trying to create entries in the file system.
574 * -1 when it could find nothing it is allowed to fix.
579 chk_path(char *name
, uid_t st_uid
, gid_t st_gid
)
586 * watch out for paths with nodes stored directly in / (e.g. /bozo)
593 * work forward from the first / and check each part of the path
595 spt
= strchr(spt
, '/');
601 * if it exists we assume it is a directory, it is not within
602 * the spec (at least it seems to read that way) to alter the
603 * file system for nodes NOT EXPLICITLY stored on the archive.
604 * If that assumption is changed, you would test the node here
605 * and figure out how to get rid of it (probably like some
606 * recursive unlink()) or fix up the directory permissions if
607 * required (do an access()).
609 if (lstat(name
, &sb
) == 0) {
615 * the path fails at this point, see if we can create the
616 * needed directory and continue on
618 if (mkdir(name
, S_IRWXU
| S_IRWXG
| S_IRWXO
) < 0) {
625 * we were able to create the directory. We will tell the
626 * caller that we found something to fix, and it is ok to try
627 * and create the node again.
631 (void)set_ids(name
, st_uid
, st_gid
);
634 * make sure the user doesn't have some strange umask that
635 * causes this newly created directory to be unusable. We fix
636 * the modes and restore them back to the creation default at
639 if ((access(name
, R_OK
| W_OK
| X_OK
) < 0) &&
640 (lstat(name
, &sb
) == 0)) {
641 set_pmode(name
, ((sb
.st_mode
& FILEBITS
) | S_IRWXU
));
642 add_dir(name
, &sb
, 1);
652 * Set the access time and modification time for a named file. If frc
653 * is non-zero we force these times to be set even if the user did not
654 * request access and/or modification time preservation (this is also
655 * used by -t to reset access times).
656 * When ign is zero, only those times the user has asked for are set, the
657 * other ones are left alone.
661 set_ftime(char *fnm
, time_t mtime
, time_t atime
, int frc
)
663 struct timespec tv
[2];
665 tv
[0].tv_sec
= atime
;
667 tv
[1].tv_sec
= mtime
;
669 if (!frc
&& (!patime
|| !pmtime
)) {
671 * if we are not forcing, only set those times the user wants
675 tv
[0].tv_nsec
= UTIME_OMIT
;
677 tv
[1].tv_nsec
= UTIME_OMIT
;
683 if (utimensat(AT_FDCWD
, fnm
, tv
, 0) < 0)
684 syswarn(1, errno
, "Access/modification time set failed on: %s",
690 fset_ftime(char *fnm
, int fd
, time_t mtime
, time_t atime
, int frc
)
692 struct timespec tv
[2];
694 tv
[0].tv_sec
= atime
;
696 tv
[1].tv_sec
= mtime
;
698 if (!frc
&& (!patime
|| !pmtime
)) {
700 * if we are not forcing, only set those times the user wants
704 tv
[0].tv_nsec
= UTIME_OMIT
;
706 tv
[1].tv_nsec
= UTIME_OMIT
;
711 if (futimens(fd
, tv
) < 0)
712 syswarn(1, errno
, "Access/modification time set failed on: %s",
719 * set the uid and gid of a file system node
721 * 0 when set, -1 on failure
725 set_ids(char *fnm
, uid_t uid
, gid_t gid
)
727 if (chown(fnm
, uid
, gid
) < 0) {
729 * ignore EPERM unless in verbose mode or being run by root.
730 * if running as pax, POSIX requires a warning.
732 if (strcmp(NM_PAX
, argv0
) == 0 || errno
!= EPERM
|| vflag
||
734 syswarn(1, errno
, "Unable to set file uid/gid of %s",
742 fset_ids(char *fnm
, int fd
, uid_t uid
, gid_t gid
)
744 if (fchown(fd
, uid
, gid
) < 0) {
746 * ignore EPERM unless in verbose mode or being run by root.
747 * if running as pax, POSIX requires a warning.
749 if (strcmp(NM_PAX
, argv0
) == 0 || errno
!= EPERM
|| vflag
||
751 syswarn(1, errno
, "Unable to set file uid/gid of %s",
760 * set the uid and gid of a file system node
762 * 0 when set, -1 on failure
766 set_lids(char *fnm
, uid_t uid
, gid_t gid
)
768 if (lchown(fnm
, uid
, gid
) < 0) {
770 * ignore EPERM unless in verbose mode or being run by root.
771 * if running as pax, POSIX requires a warning.
773 if (strcmp(NM_PAX
, argv0
) == 0 || errno
!= EPERM
|| vflag
||
775 syswarn(1, errno
, "Unable to set file uid/gid of %s",
784 * Set file access mode
788 set_pmode(char *fnm
, mode_t mode
)
791 if (chmod(fnm
, mode
) < 0)
792 syswarn(1, errno
, "Could not set permissions on %s", fnm
);
797 fset_pmode(char *fnm
, int fd
, mode_t mode
)
800 if (fchmod(fd
, mode
) < 0)
801 syswarn(1, errno
, "Could not set permissions on %s", fnm
);
807 * Write/copy a file (during copy or archive extract). This routine knows
808 * how to copy files with lseek holes in it. (Which are read as file
809 * blocks containing all 0's but do not have any file blocks associated
810 * with the data). Typical examples of these are files created by dbm
811 * variants (.pag files). While the file size of these files are huge, the
812 * actual storage is quite small (the files are sparse). The problem is
813 * the holes read as all zeros so are probably stored on the archive that
814 * way (there is no way to determine if the file block is really a hole,
815 * we only know that a file block of all zero's can be a hole).
816 * At this writing, no major archive format knows how to archive files
817 * with holes. However, on extraction (or during copy, -rw) we have to
818 * deal with these files. Without detecting the holes, the files can
819 * consume a lot of file space if just written to disk. This replacement
820 * for write when passed the basic allocation size of a file system block,
821 * uses lseek whenever it detects the input data is all 0 within that
822 * file block. In more detail, the strategy is as follows:
823 * While the input is all zero keep doing an lseek. Keep track of when we
824 * pass over file block boundaries. Only write when we hit a non zero
825 * input. once we have written a file block, we continue to write it to
826 * the end (we stop looking at the input). When we reach the start of the
827 * next file block, start checking for zero blocks again. Working on file
828 * block boundaries significantly reduces the overhead when copying files
829 * that are NOT very sparse. This overhead (when compared to a write) is
830 * almost below the measurement resolution on many systems. Without it,
831 * files with holes cannot be safely copied. It does has a side effect as
832 * it can put holes into files that did not have them before, but that is
833 * not a problem since the file contents are unchanged (in fact it saves
834 * file space). (Except on paging files for diskless clients. But since we
835 * cannot determine one of those file from here, we ignore them). If this
836 * ever ends up on a system where CTG files are supported and the holes
837 * are not desired, just do a conditional test in those routines that
838 * call file_write() and have it call write() instead. BEFORE CLOSING THE
839 * FILE, make sure to call file_flush() when the last write finishes with
840 * an empty block. A lot of file systems will not create an lseek hole at
841 * the end. In this case we drop a single 0 at the end to force the
842 * trailing 0's in the file.
844 * rem: how many bytes left in this file system block
845 * isempt: have we written to the file block yet (is it empty)
846 * sz: basic file block allocation size
847 * cnt: number of bytes on this write
848 * str: buffer to write
850 * number of bytes written, -1 on write (or lseek) error.
854 file_write(int fd
, char *str
, int cnt
, int *rem
, int *isempt
, int sz
,
864 * while we have data to process
869 * We are now at the start of file system block again
870 * (or what we think one is...). start looking for
878 * only examine up to the end of the current file block or
879 * remaining characters to write, whatever is smaller
881 wcnt
= MIN(cnt
, *rem
);
886 * have not written to this block yet, so we keep
893 * look for a zero filled buffer
895 while ((pt
< end
) && (*pt
== '\0'))
900 * skip, buf is empty so far
903 lseek(fd
, (off_t
)wcnt
, SEEK_CUR
) < 0) {
904 syswarn(1,errno
,"File seek on %s",
912 * drat, the buf is not zero filled
918 * have non-zero data in this file system block, have to write
922 strp
= &gnu_name_string
;
925 strp
= &gnu_link_string
;
933 err(1, "WARNING! Major Internal Error! GNU hack Failing!");
934 *strp
= malloc(wcnt
+ 1);
936 paxwarn(1, "Out of memory");
939 memcpy(*strp
, st
, wcnt
);
940 (*strp
)[wcnt
] = '\0';
942 } else if (write(fd
, st
, wcnt
) != wcnt
) {
943 syswarn(1, errno
, "Failed write to file %s", name
);
953 * when the last file block in a file is zero, many file systems will not
954 * let us create a hole at the end. To get the last block with zeros, we
955 * write the last BYTE with a zero (back up one byte and write a zero).
959 file_flush(int fd
, char *fname
, int isempt
)
961 static char blnk
[] = "\0";
964 * silly test, but make sure we are only called when the last block is
965 * filled with all zeros.
971 * move back one byte and write a zero
973 if (lseek(fd
, (off_t
)-1, SEEK_CUR
) < 0) {
974 syswarn(1, errno
, "Failed seek on file %s", fname
);
978 if (write(fd
, blnk
, 1) < 0)
979 syswarn(1, errno
, "Failed write to file %s", fname
);
985 * close a file we have been reading (to copy or archive). If we have to
986 * reset access time (tflag) do so (the times are stored in arcn).
990 rdfile_close(ARCHD
*arcn
, int *fd
)
993 * make sure the file is open
1004 * user wants last access time reset
1006 set_ftime(arcn
->org_name
, arcn
->sb
.st_mtime
, arcn
->sb
.st_atime
, 1);
1012 * read a file to calculate its crc. This is a real drag. Archive formats
1013 * that have this, end up reading the file twice (we have to write the
1014 * header WITH the crc before writing the file contents. Oh well...
1016 * 0 if was able to calculate the crc, -1 otherwise
1020 set_crc(ARCHD
*arcn
, int fd
)
1032 * hmm, no fd, should never happen. well no crc then.
1038 if ((size
= (u_long
)arcn
->sb
.st_blksize
) > (u_long
)sizeof(tbuf
))
1039 size
= (u_long
)sizeof(tbuf
);
1042 * read all the bytes we think that there are in the file. If the user
1043 * is trying to archive an active file, forget this file.
1046 if ((res
= read(fd
, tbuf
, size
)) <= 0)
1049 for (i
= 0; i
< res
; ++i
)
1050 crc
+= (tbuf
[i
] & 0xff);
1054 * safety check. we want to avoid archiving files that are active as
1055 * they can create inconsistent archive copies.
1057 if (cpcnt
!= arcn
->sb
.st_size
)
1058 paxwarn(1, "File changed size %s", arcn
->org_name
);
1059 else if (fstat(fd
, &sb
) < 0)
1060 syswarn(1, errno
, "Failed stat on %s", arcn
->org_name
);
1061 else if (arcn
->sb
.st_mtime
!= sb
.st_mtime
)
1062 paxwarn(1, "File %s was modified during read", arcn
->org_name
);
1063 else if (lseek(fd
, (off_t
)0L, SEEK_SET
) < 0)
1064 syswarn(1, errno
, "File rewind failed on: %s", arcn
->org_name
);