[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH v2 4/5] virfile: virDirCreate: Drop redundand FORCE_PERMS flag



The only two virDirCreate callers already use it
---
 src/storage/storage_backend_fs.c | 2 --
 src/util/virfile.c               | 6 ++----
 src/util/virfile.h               | 3 +--
 3 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 62949ba..ed56935 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -806,7 +806,6 @@ virStorageBackendFileSystemBuild(virConnectPtr conn ATTRIBUTE_UNUSED,
                              pool->def->target.perms.mode),
                             pool->def->target.perms.uid,
                             pool->def->target.perms.gid,
-                            VIR_DIR_CREATE_FORCE_PERMS |
                             VIR_DIR_CREATE_ALLOW_EXIST |
                             (pool->def->type == VIR_STORAGE_POOL_NETFS
                             ? VIR_DIR_CREATE_AS_UID : 0))) < 0) {
@@ -1080,7 +1079,6 @@ static int createFileDir(virConnectPtr conn ATTRIBUTE_UNUSED,
                              vol->target.perms->mode),
                             vol->target.perms->uid,
                             vol->target.perms->gid,
-                            VIR_DIR_CREATE_FORCE_PERMS |
                             (pool->def->type == VIR_STORAGE_POOL_NETFS
                              ? VIR_DIR_CREATE_AS_UID : 0))) < 0) {
         return -1;
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 6e9ecbe..63eafdf 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -2311,8 +2311,7 @@ virDirCreateNoFork(const char *path,
                              path, (unsigned int) uid, (unsigned int) gid);
         goto error;
     }
-    if ((flags & VIR_DIR_CREATE_FORCE_PERMS)
-        && (chmod(path, mode) < 0)) {
+    if (chmod(path, mode) < 0) {
         ret = -errno;
         virReportSystemError(errno,
                              _("cannot set mode of '%s' to %04o"),
@@ -2425,8 +2424,7 @@ virDirCreate(const char *path,
                              path, (unsigned int) gid);
         goto childerror;
     }
-    if ((flags & VIR_DIR_CREATE_FORCE_PERMS)
-        && chmod(path, mode) < 0) {
+    if (chmod(path, mode) < 0) {
         virReportSystemError(errno,
                              _("cannot set mode of '%s' to %04o"),
                              path, mode);
diff --git a/src/util/virfile.h b/src/util/virfile.h
index 403d0ba..2d27e89 100644
--- a/src/util/virfile.h
+++ b/src/util/virfile.h
@@ -223,8 +223,7 @@ int virFileOpenAs(const char *path, int openflags, mode_t mode,
 enum {
     VIR_DIR_CREATE_NONE        = 0,
     VIR_DIR_CREATE_AS_UID      = (1 << 0),
-    VIR_DIR_CREATE_FORCE_PERMS = (1 << 1),
-    VIR_DIR_CREATE_ALLOW_EXIST = (1 << 2),
+    VIR_DIR_CREATE_ALLOW_EXIST = (1 << 1),
 };
 int virDirCreate(const char *path, mode_t mode, uid_t uid, gid_t gid,
                  unsigned int flags) ATTRIBUTE_RETURN_CHECK;
-- 
2.4.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]