return 0;
}
- /* Change its ownership if requested */
- if ((uid || gid) && chown(p, uid, gid) < 0) {
+ /* Set its owner */
+ if (chown(p, uid, gid) < 0) {
LOG(LOGS_ERR, LOGF_Util, "Could not change ownership of %s : %s", p, strerror(errno));
/* Don't leave it there with incorrect ownership */
rmdir(p);
/* Get directory (as an allocated string) for a path */
extern char *UTI_PathToDir(const char *path);
-/* Create a directory with a specified mode (umasked) and set its uid/gid
- (if not 0). Create also any parent directories that don't exist with mode
- 755 and default uid/gid. Returns 1 if created or already exists (even with
+/* Create a directory with a specified mode (umasked) and set its uid/gid.
+ Create also any parent directories that don't exist with mode 755 and
+ default uid/gid. Returns 1 if created or already exists (even with
different mode/uid/gid), 0 otherwise. */
extern int UTI_CreateDirAndParents(const char *path, mode_t mode, uid_t uid, gid_t gid);