From c225633528e262ab8ef2e78ff85732e386fe175e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 2 Jan 2006 06:33:12 +0000 Subject: Include lchmod.h, lchmod.c. (make_dir_parents): Use lchown rather than chown, and lchmod rather than chmod. --- lib/mkdir-p.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/mkdir-p.c b/lib/mkdir-p.c index 83c2aa65f..dd42b6ca5 100644 --- a/lib/mkdir-p.c +++ b/lib/mkdir-p.c @@ -1,6 +1,6 @@ /* mkdir-p.c -- Ensure that a directory and its parents exist. - Copyright (C) 1990, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005 + Copyright (C) 1990, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -42,6 +42,8 @@ #include "chdir-safer.h" #include "dirname.h" #include "error.h" +#include "lchmod.h" +#include "lchown.h" #include "quote.h" #include "save-cwd.h" #include "stat-macros.h" @@ -195,7 +197,7 @@ make_dir_parents (char const *arg, error (0, 0, verbose_fmt_string, quote (dir)); if ((owner != (uid_t) -1 || group != (gid_t) -1) - && chown (basename_dir, owner, group) + && lchown (basename_dir, owner, group) #if defined AFS && defined EPERM && errno != EPERM #endif @@ -302,7 +304,7 @@ make_dir_parents (char const *arg, if (owner != (uid_t) -1 || group != (gid_t) -1) { - if (chown (fixup_permissions_dir, owner, group) != 0 + if (lchown (fixup_permissions_dir, owner, group) != 0 #ifdef AFS && errno != EPERM #endif @@ -319,7 +321,7 @@ make_dir_parents (char const *arg, required to honor only the file permission bits. In particular, it need not honor the `special' bits, so if MODE includes any special bits, set them here. */ - if ((mode & ~S_IRWXUGO) && chmod (fixup_permissions_dir, mode) != 0) + if ((mode & ~S_IRWXUGO) && lchmod (fixup_permissions_dir, mode) != 0) { error (0, errno, _("cannot change permissions of %s"), quote (full_dir)); @@ -343,7 +345,7 @@ make_dir_parents (char const *arg, { leading_dirs->dirname_end[0] = '\0'; if ((cwd_problem && *full_dir != '/') - || chmod (full_dir, parent_mode) != 0) + || lchmod (full_dir, parent_mode) != 0) { error (0, (cwd_problem ? 0 : errno), _("cannot change permissions of %s"), quote (full_dir)); -- cgit v1.2.3-70-g09d2