diff options
Diffstat (limited to 'bin/pax/file_subs.c')
-rw-r--r-- | bin/pax/file_subs.c | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/bin/pax/file_subs.c b/bin/pax/file_subs.c index b8f2a49..b3126f5 100644 --- a/bin/pax/file_subs.c +++ b/bin/pax/file_subs.c @@ -75,7 +75,7 @@ mk_link __P((register char *,register struct stat *,register char *, int)); * file descriptor or -1 for failure */ -#if __STDC__ +#ifdef __STDC__ int file_creat(register ARCHD *arcn) #else @@ -123,7 +123,7 @@ file_creat(arcn) break; oerrno = errno; if (chk_path(arcn->name,arcn->sb.st_uid,arcn->sb.st_gid) < 0) { - sys_warn(1, oerrno, "Unable to create %s", arcn->name); + syswarn(1, oerrno, "Unable to create %s", arcn->name); return(-1); } } @@ -138,7 +138,7 @@ file_creat(arcn) * 0 for success, -1 for failure */ -#if __STDC__ +#ifdef __STDC__ void file_close(register ARCHD *arcn, int fd) #else @@ -153,7 +153,7 @@ file_close(arcn, fd) if (fd < 0) return; if (close(fd) < 0) - sys_warn(0, errno, "Unable to close file descriptor on %s", + syswarn(0, errno, "Unable to close file descriptor on %s", arcn->name); /* @@ -185,7 +185,7 @@ file_close(arcn, fd) * 0 if ok, -1 otherwise */ -#if __STDC__ +#ifdef __STDC__ int lnk_creat(register ARCHD *arcn) #else @@ -201,13 +201,13 @@ lnk_creat(arcn) * is not a directory, so we lstat and check */ if (lstat(arcn->ln_name, &sb) < 0) { - sys_warn(1,errno,"Unable to link to %s from %s", arcn->ln_name, + syswarn(1,errno,"Unable to link to %s from %s", arcn->ln_name, arcn->name); return(-1); } if (S_ISDIR(sb.st_mode)) { - pax_warn(1, "A hard link to the directory %s is not allowed", + paxwarn(1, "A hard link to the directory %s is not allowed", arcn->ln_name); return(-1); } @@ -218,14 +218,14 @@ lnk_creat(arcn) /* * cross_lnk() * Create a hard link to arcn->org_name from arcn->name. Only used in copy - * with the -l flag. No pax_warning or error if this does not succeed (we will + * with the -l flag. No warning or error if this does not succeed (we will * then just create the file) * Return: * 1 if copy() should try to create this file node * 0 if cross_lnk() ok, -1 for fatal flaw (like linking to self). */ -#if __STDC__ +#ifdef __STDC__ int cross_lnk(register ARCHD *arcn) #else @@ -255,7 +255,7 @@ cross_lnk(arcn) * 0 skip it file exists (-k) or may be the same as source file */ -#if __STDC__ +#ifdef __STDC__ int chk_same(register ARCHD *arcn) #else @@ -279,7 +279,7 @@ chk_same(arcn) * better make sure the user does not have src == dest by mistake */ if ((arcn->sb.st_dev == sb.st_dev) && (arcn->sb.st_ino == sb.st_ino)) { - pax_warn(1, "Unable to copy %s, file would overwrite itself", + paxwarn(1, "Unable to copy %s, file would overwrite itself", arcn->name); return(0); } @@ -298,7 +298,7 @@ chk_same(arcn) * allowed option). -1 an error occurred. */ -#if __STDC__ +#ifdef __STDC__ static int mk_link(register char *to, register struct stat *to_sb, register char *from, int ign) @@ -326,7 +326,7 @@ mk_link(to, to_sb, from, ign) * 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)) { - pax_warn(1, "Unable to link file %s to itself", to); + paxwarn(1, "Unable to link file %s to itself", to); return(-1);; } @@ -335,12 +335,12 @@ mk_link(to, to_sb, from, ign) */ if (S_ISDIR(sb.st_mode)) { if (rmdir(from) < 0) { - sys_warn(1, errno, "Unable to remove %s", from); + syswarn(1, errno, "Unable to remove %s", from); return(-1); } } else if (unlink(from) < 0) { if (!ign) { - sys_warn(1, errno, "Unable to remove %s", from); + syswarn(1, errno, "Unable to remove %s", from); return(-1); } return(1); @@ -359,7 +359,7 @@ mk_link(to, to_sb, from, ign) if (chk_path(from, to_sb->st_uid, to_sb->st_gid) == 0) continue; if (!ign) { - sys_warn(1, oerrno, "Could not link to %s from %s", to, + syswarn(1, oerrno, "Could not link to %s from %s", to, from); return(-1); } @@ -380,7 +380,7 @@ mk_link(to, to_sb, from, ign) * 0 if ok, -1 otherwise */ -#if __STDC__ +#ifdef __STDC__ int node_creat(register ARCHD *arcn) #else @@ -426,7 +426,7 @@ node_creat(arcn) /* * Skip sockets, operation has no meaning under BSD */ - pax_warn(0, + paxwarn(0, "%s skipped. Sockets cannot be copied or extracted", arcn->name); return(-1); @@ -442,7 +442,7 @@ node_creat(arcn) /* * we should never get here */ - pax_warn(0, "%s has an unknown file type, skipping", + paxwarn(0, "%s has an unknown file type, skipping", arcn->name); return(-1); } @@ -466,7 +466,7 @@ node_creat(arcn) continue; if (chk_path(arcn->name,arcn->sb.st_uid,arcn->sb.st_gid) < 0) { - sys_warn(1, oerrno, "Could not create: %s", arcn->name); + syswarn(1, oerrno, "Could not create: %s", arcn->name); return(-1); } } @@ -501,7 +501,7 @@ node_creat(arcn) */ if (access(arcn->name, R_OK | W_OK | X_OK) < 0) { if (lstat(arcn->name, &sb) < 0) { - sys_warn(0, errno,"Could not access %s (stat)", + syswarn(0, errno,"Could not access %s (stat)", arcn->name); set_pmode(arcn->name,file_mode | S_IRWXU); } else { @@ -543,7 +543,7 @@ node_creat(arcn) * 1 we found a directory and we were going to create a directory. */ -#if __STDC__ +#ifdef __STDC__ int unlnk_exist(register char *name, register int type) #else @@ -571,7 +571,7 @@ unlnk_exist(name, type) if (rmdir(name) < 0) { if (type == PAX_DIR) return(1); - sys_warn(1,errno,"Unable to remove directory %s", name); + syswarn(1,errno,"Unable to remove directory %s", name); return(-1); } return(0); @@ -581,7 +581,7 @@ unlnk_exist(name, type) * try to get rid of all non-directory type nodes */ if (unlink(name) < 0) { - sys_warn(1, errno, "Could not unlink %s", name); + syswarn(1, errno, "Could not unlink %s", name); return(-1); } return(0); @@ -601,7 +601,7 @@ unlnk_exist(name, type) * 0 otherwise */ -#if __STDC__ +#ifdef __STDC__ int chk_path( register char *name, uid_t st_uid, gid_t st_gid) #else @@ -684,7 +684,7 @@ chk_path(name, st_uid, st_gid) /* * set_ftime() * Set the access time and modification time for a named file. If frc is - * non-zero we force these times to be set even if the the user did not + * non-zero we force these times to be set even if the user did not * request access and/or modification time preservation (this is also * used by -t to reset access times). * When ign is zero, only those times the user has asked for are set, the @@ -693,7 +693,7 @@ chk_path(name, st_uid, st_gid) * not set request. */ -#if __STDC__ +#ifdef __STDC__ void set_ftime(char *fnm, time_t mtime, time_t atime, int frc) #else @@ -721,14 +721,14 @@ set_ftime(fnm, mtime, atime, frc) if (!pmtime) tv[1].tv_sec = (long)sb.st_mtime; } else - sys_warn(0,errno,"Unable to obtain file stats %s", fnm); + syswarn(0,errno,"Unable to obtain file stats %s", fnm); } /* * set the times */ if (utimes(fnm, tv) < 0) - sys_warn(1, errno, "Access/modification time set failed on: %s", + syswarn(1, errno, "Access/modification time set failed on: %s", fnm); return; } @@ -740,7 +740,7 @@ set_ftime(fnm, mtime, atime, frc) * 0 when set, -1 on failure */ -#if __STDC__ +#ifdef __STDC__ int set_ids(char *fnm, uid_t uid, gid_t gid) #else @@ -752,7 +752,7 @@ set_ids(fnm, uid, gid) #endif { if (chown(fnm, uid, gid) < 0) { - sys_warn(1, errno, "Unable to set file uid/gid of %s", fnm); + syswarn(1, errno, "Unable to set file uid/gid of %s", fnm); return(-1); } return(0); @@ -763,7 +763,7 @@ set_ids(fnm, uid, gid) * Set file access mode */ -#if __STDC__ +#ifdef __STDC__ void set_pmode(char *fnm, mode_t mode) #else @@ -775,7 +775,7 @@ set_pmode(fnm, mode) { mode &= ABITS; if (chmod(fnm, mode) < 0) - sys_warn(1, errno, "Could not set permissions on %s", fnm); + syswarn(1, errno, "Could not set permissions on %s", fnm); return; } @@ -827,7 +827,7 @@ set_pmode(fnm, mode) * number of bytes written, -1 on write (or lseek) error. */ -#if __STDC__ +#ifdef __STDC__ int file_write(int fd, char *str, register int cnt, int *rem, int *isempt, int sz, char *name) @@ -888,7 +888,7 @@ file_write(fd, str, cnt, rem, isempt, sz, name) * skip, buf is empty so far */ if (lseek(fd, (off_t)wcnt, SEEK_CUR) < 0) { - sys_warn(1,errno,"File seek on %s", + syswarn(1,errno,"File seek on %s", name); return(-1); } @@ -905,7 +905,7 @@ file_write(fd, str, cnt, rem, isempt, sz, name) * have non-zero data in this file system block, have to write */ if (write(fd, st, wcnt) != wcnt) { - sys_warn(1, errno, "Failed write to file %s", name); + syswarn(1, errno, "Failed write to file %s", name); return(-1); } st += wcnt; @@ -920,7 +920,7 @@ file_write(fd, str, cnt, rem, isempt, sz, name) * write the last BYTE with a zero (back up one byte and write a zero). */ -#if __STDC__ +#ifdef __STDC__ void file_flush(int fd, char *fname, int isempt) #else @@ -944,12 +944,12 @@ file_flush(fd, fname, isempt) * move back one byte and write a zero */ if (lseek(fd, (off_t)-1, SEEK_CUR) < 0) { - sys_warn(1, errno, "Failed seek on file %s", fname); + syswarn(1, errno, "Failed seek on file %s", fname); return; } if (write(fd, blnk, 1) < 0) - sys_warn(1, errno, "Failed write to file %s", fname); + syswarn(1, errno, "Failed write to file %s", fname); return; } @@ -959,7 +959,7 @@ file_flush(fd, fname, isempt) * reset access time (tflag) do so (the times are stored in arcn). */ -#if __STDC__ +#ifdef __STDC__ void rdfile_close(register ARCHD *arcn, register int *fd) #else @@ -996,7 +996,7 @@ rdfile_close(arcn, fd) * 0 if was able to calculate the crc, -1 otherwise */ -#if __STDC__ +#ifdef __STDC__ int set_crc(register ARCHD *arcn, register int fd) #else @@ -1042,13 +1042,13 @@ set_crc(arcn, fd) * they can create inconsistant archive copies. */ if (cpcnt != arcn->sb.st_size) - pax_warn(1, "File changed size %s", arcn->org_name); + paxwarn(1, "File changed size %s", arcn->org_name); else if (fstat(fd, &sb) < 0) - sys_warn(1, errno, "Failed stat on %s", arcn->org_name); + syswarn(1, errno, "Failed stat on %s", arcn->org_name); else if (arcn->sb.st_mtime != sb.st_mtime) - pax_warn(1, "File %s was modified during read", arcn->org_name); + paxwarn(1, "File %s was modified during read", arcn->org_name); else if (lseek(fd, (off_t)0L, SEEK_SET) < 0) - sys_warn(1, errno, "File rewind failed on: %s", arcn->org_name); + syswarn(1, errno, "File rewind failed on: %s", arcn->org_name); else { arcn->crc = crc; return(0); |