summaryrefslogtreecommitdiff
path: root/src/cp.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-01-02 06:36:55 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2006-01-02 06:36:55 +0000
commit4aff81e69a0c3ce376e331a088f0839335f8400d (patch)
tree23a0df2e35f923a0b88c983f879c4e7a7880ee53 /src/cp.c
parentfaac2ccac55f6dcfb268a94d5371f99e34d7f6fc (diff)
downloadcoreutils-4aff81e69a0c3ce376e331a088f0839335f8400d.tar.xz
Include lchmod.h.
(re_protect, make_dir_parents_private): Use lchmod rather than chmod.
Diffstat (limited to 'src/cp.c')
-rw-r--r--src/cp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cp.c b/src/cp.c
index 0da15233c..3f5334069 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));