From 528fe6e50441461271655ed8adf933c65597ee3c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 29 Jul 2006 17:13:28 +0000 Subject: [PATCH] (set_author): Preserve the st_author field via the file descriptor dest_desc. --- ChangeLog | 6 ++++++ src/copy.c | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e6a43de..f3ce490 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,13 @@ +2006-07-29 Paul Eggert + + * src/copy.c (set_author): Preserve the st_author field via the + file descriptor dest_desc. + 2006-07-28 Paul Eggert * NEWS: chmod now preserves setuid and setgid bits on directories if you use a numeric mode with them clear, e.g., "chmod 755 DIR". + Fix test case problems if working directory is setgid, reported by Bob Proulx. * tests/cp/fail-perm: Use symbolic mode so that we clear diff --git a/src/copy.c b/src/copy.c index ac54e48..3bd29e2 100644 --- a/src/copy.c +++ b/src/copy.c @@ -213,10 +213,11 @@ set_owner (const struct cp_options *x, char const *dst_name, int dest_desc, static void set_author (const char *dst_name, int dest_desc, const struct stat *src_sb) { - /* FIXME: Preserve the st_author field via the file descriptor dest_desc. */ #if HAVE_STRUCT_STAT_ST_AUTHOR /* Preserve the st_author field. */ - file_t file = file_name_lookup (dst_name, 0, 0); + file_t file = (dest_desc < 0 + ? file_name_lookup (dst_name, 0, 0) + : getdport (dest_desc)); if (file == MACH_PORT_NULL) error (0, errno, _("failed to lookup file %s"), quote (dst_name)); else -- 2.7.4