diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-02-23 00:41:54 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-02-23 00:41:54 +0200 |
commit | 7543ff5973d1afe75b0f4226a3a02cc8d375ad3e (patch) | |
tree | 27a8b45adacc99d929c12679512d9e8adf9b5500 /src/diskio.c | |
parent | cc980787791b10c2a8e95e07d40973861e00a8d9 (diff) | |
download | wydawca-7543ff5973d1afe75b0f4226a3a02cc8d375ad3e.tar.gz wydawca-7543ff5973d1afe75b0f4226a3a02cc8d375ad3e.tar.bz2 |
Switch to user privileges while processing the triplet
Diffstat (limited to 'src/diskio.c')
-rw-r--r-- | src/diskio.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/diskio.c b/src/diskio.c index 6e75ccd..2604c67 100644 --- a/src/diskio.c +++ b/src/diskio.c @@ -121,10 +121,17 @@ create_directory (const char *base, const char *name, uid_t uid, gid_t gid) size_t baselen; char *dir = concat_dir (base, name, &baselen); - if (!dry_run_mode && create_hierarchy (dir, baselen, uid, gid)) + if (!dry_run_mode) { - free (dir); - dir = NULL; + int rc; + wydawca_uid (0); + rc = create_hierarchy (dir, baselen, uid, gid); + wydawca_uid (uid); + if (rc) + { + free (dir); + dir = NULL; + } } return dir; } |