|
a/src/utils/copyfile.cpp |
|
b/src/utils/copyfile.cpp |
|
... |
|
... |
108 |
}
|
108 |
}
|
109 |
|
109 |
|
110 |
// Try to preserve modes, owner, times. This may fail for a number
|
110 |
// Try to preserve modes, owner, times. This may fail for a number
|
111 |
// of reasons
|
111 |
// of reasons
|
112 |
if ((st1.st_mode & 0777) != (st.st_mode & 0777)) {
|
112 |
if ((st1.st_mode & 0777) != (st.st_mode & 0777)) {
|
113 |
chmod(dst, st.st_mode&0777);
|
113 |
if (chmod(dst, st.st_mode&0777) != 0) {
|
|
|
114 |
reason += string("Chmod ") + dst + "Error : " + strerror(errno);
|
|
|
115 |
}
|
114 |
}
|
116 |
}
|
115 |
if (st.st_uid != st1.st_uid || st.st_gid != st1.st_gid) {
|
117 |
if (st.st_uid != st1.st_uid || st.st_gid != st1.st_gid) {
|
116 |
chown(dst, st.st_uid, st.st_gid);
|
118 |
if (chown(dst, st.st_uid, st.st_gid) != 0) {
|
|
|
119 |
reason += string("Chown ") + dst + "Error : " + strerror(errno);
|
|
|
120 |
}
|
117 |
}
|
121 |
}
|
118 |
struct timeval times[2];
|
122 |
struct timeval times[2];
|
119 |
times[0].tv_sec = st.st_atime;
|
123 |
times[0].tv_sec = st.st_atime;
|
120 |
times[0].tv_usec = 0;
|
124 |
times[0].tv_usec = 0;
|
121 |
times[1].tv_sec = st.st_mtime;
|
125 |
times[1].tv_sec = st.st_mtime;
|
|
... |
|
... |
190 |
ret = copyfile(src.c_str(), dst.c_str(), reason);
|
194 |
ret = copyfile(src.c_str(), dst.c_str(), reason);
|
191 |
}
|
195 |
}
|
192 |
if (!ret) {
|
196 |
if (!ret) {
|
193 |
cerr << reason << endl;
|
197 |
cerr << reason << endl;
|
194 |
exit(1);
|
198 |
exit(1);
|
|
|
199 |
} else {
|
|
|
200 |
cout << "Succeeded" << endl;
|
|
|
201 |
if (!reason.empty()) {
|
|
|
202 |
cout << "Warnings: " << reason << endl;
|
|
|
203 |
}
|
|
|
204 |
exit(0);
|
195 |
}
|
205 |
}
|
196 |
exit(0);
|
|
|
197 |
}
|
206 |
}
|
198 |
|
|
|
199 |
|
207 |
|
200 |
#endif
|
208 |
#endif
|