Changeset View
Changeset View
Standalone View
Standalone View
bin/cp/utils.c
Context not available. | |||||
static struct timespec tspec[2]; | static struct timespec tspec[2]; | ||||
struct stat ts; | struct stat ts; | ||||
int rval, gotstat, islink, fdval; | int rval, gotstat, islink, fdval; | ||||
unsigned long tflags; | |||||
rval = 0; | rval = 0; | ||||
fdval = fd != -1; | fdval = fd != -1; | ||||
Context not available. | |||||
rval = 1; | rval = 1; | ||||
} | } | ||||
if (!gotstat || fs->st_flags != ts.st_flags) | /* Follow mv(1)'s logic WRT file flags. See its fastcopy() function. | ||||
* Same caveats apply. */ | |||||
if (!gotstat || | |||||
(fs->st_flags & ~UF_ARCHIVE) != (ts.st_flags & ~UF_ARCHIVE)) { | |||||
tflags = fs->st_flags | | |||||
(gotstat ? (ts.st_flags & UF_ARCHIVE) : 0); | |||||
if (fdval ? | if (fdval ? | ||||
fchflags(fd, fs->st_flags) : | fchflags(fd, tflags) : | ||||
(islink ? lchflags(to.p_path, fs->st_flags) : | (islink ? lchflags(to.p_path, tflags) : | ||||
chflags(to.p_path, fs->st_flags))) { | chflags(to.p_path, tflags))) { | ||||
warn("chflags: %s", to.p_path); | if (errno != EOPNOTSUPP || | ||||
rval = 1; | ((fs->st_flags & ~UF_ARCHIVE) != 0)) { | ||||
warn("chflags: %s", to.p_path); | |||||
rval = 1; | |||||
} | |||||
} | } | ||||
} | |||||
return (rval); | return (rval); | ||||
} | } | ||||
Context not available. |