From f0a5712f74cd07d74d7a4c1d057a94521e6998f7 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 19 Jun 2003 21:17:48 +0000 Subject: [PATCH] (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]: Fix author preservation code. --- src/copy.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/copy.c b/src/copy.c index a2774f5ad1..edc05fec17 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 -- 2.47.2