cp: Check result of utimensat
POSIX says that if duplicating the modification/access times fails, then an error should be written to stderr.
This commit is contained in:
parent
a8a9b3bae9
commit
e03a57df92
@ -156,8 +156,10 @@ cp(const char *s1, const char *s2, int depth)
|
|||||||
if (!S_ISLNK(st.st_mode)) {
|
if (!S_ISLNK(st.st_mode)) {
|
||||||
times[0] = st.st_atim;
|
times[0] = st.st_atim;
|
||||||
times[1] = st.st_mtim;
|
times[1] = st.st_mtim;
|
||||||
utimensat(AT_FDCWD, s2, times, 0);
|
if (utimensat(AT_FDCWD, s2, times, 0) < 0) {
|
||||||
|
weprintf("utimensat %s:", s2);
|
||||||
|
cp_status = 1;
|
||||||
|
}
|
||||||
if (chown(s2, st.st_uid, st.st_gid) < 0) {
|
if (chown(s2, st.st_uid, st.st_gid) < 0) {
|
||||||
weprintf("chown %s:", s2);
|
weprintf("chown %s:", s2);
|
||||||
cp_status = 1;
|
cp_status = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user