aboutsummaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
Diffstat (limited to 'utility.c')
-rw-r--r--utility.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/utility.c b/utility.c
index c10f9bb8a..191701bed 100644
--- a/utility.c
+++ b/utility.c
@@ -182,6 +182,11 @@ copyFile( const char *srcName, const char *destName,
182 perror(destName); 182 perror(destName);
183 return (FALSE); 183 return (FALSE);
184 } 184 }
185#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
186 if (setModes == TRUE) {
187 lchown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid);
188 }
189#endif
185 } else if (S_ISFIFO(srcStatBuf.st_mode)) { 190 } else if (S_ISFIFO(srcStatBuf.st_mode)) {
186 //fprintf(stderr, "copying fifo %s to %s\n", srcName, destName); 191 //fprintf(stderr, "copying fifo %s to %s\n", srcName, destName);
187 if (mkfifo(destName, 0644)) { 192 if (mkfifo(destName, 0644)) {
@@ -225,16 +230,9 @@ copyFile( const char *srcName, const char *destName,
225 } 230 }
226 231
227 if (setModes == TRUE) { 232 if (setModes == TRUE) {
228 if (! S_ISLNK(srcStatBuf.st_mode)) { 233 /* This is fine, since symlinks never get here */
229 chown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid); 234 chown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid);
230 /* Never chmod a symlink; it follows the link */ 235 chmod(destName, srcStatBuf.st_mode);
231 chmod(destName, srcStatBuf.st_mode);
232 }
233#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
234 else {
235 lchown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid);
236 }
237#endif
238 times.actime = srcStatBuf.st_atime; 236 times.actime = srcStatBuf.st_atime;
239 times.modtime = srcStatBuf.st_mtime; 237 times.modtime = srcStatBuf.st_mtime;
240 utime(destName, &times); 238 utime(destName, &times);