summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-06-19 21:17:48 +0000
committerJim Meyering <jim@meyering.net>2003-06-19 21:17:48 +0000
commitf0a5712f74cd07d74d7a4c1d057a94521e6998f7 (patch)
treec19ec79610a8225ee884fb58e615ce0d1d8cdd54 /src
parent2b046985663d116b0c7d657f58c94b49cd14c97f (diff)
downloadcoreutils-f0a5712f74cd07d74d7a4c1d057a94521e6998f7.tar.xz
(copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
Fix author preservation code.
Diffstat (limited to 'src')
-rw-r--r--src/copy.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/copy.c b/src/copy.c
index a2774f5ad..edc05fec1 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -1562,10 +1562,16 @@ copy_internal (const char *src_path, const char *dst_path,
/* Preserve the st_author field. */
{
file_t file = file_name_lookup (dst_path, 0, 0);
- if (file_chauthor (file, src_sb.st_author))
- error (0, errno, _("failed to preserve authorship for %s"),
- quote (dst_path));
- mach_port_deallocate (mach_task_self (), file);
+ if (file == MACH_PORT_NULL)
+ error (0, errno, _("failed to lookup file %s"), quote (dst_path));
+ else
+ {
+ int err = file_chauthor (file, src_sb.st_author);
+ if (err)
+ error (0, err, _("failed to preserve authorship for %s"),
+ quote (dst_path));
+ mach_port_deallocate (mach_task_self (), file);
+ }
}
#endif