From: Paul Eggert Date: Mon, 2 Jan 2006 06:36:55 +0000 (+0000) Subject: Include lchmod.h. X-Git-Tag: v6.0~1006 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4aff81e69a0c3ce376e331a088f0839335f8400d;p=thirdparty%2Fcoreutils.git Include lchmod.h. (re_protect, make_dir_parents_private): Use lchmod rather than chmod. --- diff --git a/src/cp.c b/src/cp.c index 0da15233c6..3f5334069b 100644 --- a/src/cp.c +++ b/src/cp.c @@ -1,5 +1,5 @@ /* cp.c -- file copying (main routines) - Copyright (C) 89, 90, 91, 1995-2005 Free Software Foundation. + Copyright (C) 89, 90, 91, 1995-2006 Free Software Foundation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +30,7 @@ #include "error.h" #include "dirname.h" #include "filenamecat.h" +#include "lchmod.h" #include "quote.h" #include "quotearg.h" #include "stat-time.h" @@ -335,7 +336,7 @@ re_protect (char const *const_dst_name, size_t src_offset, } else if (p->restore_mode) { - if (chmod (dst_name, p->mode)) + if (lchmod (dst_name, p->mode) != 0) { error (0, errno, _("failed to preserve permissions for %s"), quote (dst_name)); @@ -466,7 +467,7 @@ make_dir_parents_private (char const *const_dir, size_t src_offset, new->mode = stats.st_mode; new->restore_mode = true; - if (chmod (dir, stats.st_mode | S_IRWXU)) + if (lchmod (dir, stats.st_mode | S_IRWXU) != 0) { error (0, errno, _("setting permissions for %s"), quote (dir));