From: Jim Meyering Date: Thu, 19 Jun 2003 21:17:48 +0000 (+0000) Subject: (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]: X-Git-Tag: v5.0.1~191 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0a5712f74cd07d74d7a4c1d057a94521e6998f7;p=thirdparty%2Fcoreutils.git (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]: Fix author preservation code. --- 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