summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-06-21 12:06:17 +0000
committerJim Meyering <jim@meyering.net>2002-06-21 12:06:17 +0000
commitd7313803f0c137a83787ea1166c30f9bf84de1d1 (patch)
tree25fdb90707dae5576ea87e80c27f09396f2f8d40 /src
parent26ba37793c2e65a82ce034ee75332b42d339f945 (diff)
downloadcoreutils-d7313803f0c137a83787ea1166c30f9bf84de1d1.tar.xz
Include hurd.h.
(copy_internal): Preserve the stat.st_author field.
Diffstat (limited to 'src')
-rw-r--r--src/copy.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/copy.c b/src/copy.c
index ea83afac7..8df19ce9e 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -26,6 +26,10 @@
#include <assert.h>
#include <sys/types.h>
+#if HAVE_HURD_H
+# include <hurd.h>
+#endif
+
#include "system.h"
#include "error.h"
#include "backupfile.h"
@@ -1508,6 +1512,16 @@ copy_internal (const char *src_path, const char *dst_path,
}
}
+#if HAVE_STRUCT_STAT_ST_AUTHOR
+ /* Preserve the st_author field. */
+ {
+ file_t file = getdport (dst_path);
+ if (file_chauthor (file, src_sb.st_author))
+ error (0, errno, _("preserving authorship for %s"), quote (dst_path));
+ mach_port_deallocate (mach_task_self (), file);
+ }
+#endif
+
/* Permissions of newly-created regular files were set upon `open' in
copy_reg. But don't return early if there were any special bits and
we had to run chown, because the chown must have reset those bits. */