mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
virfile: virDirCreate: Drop redundant FORCE_PERMS flag
The only two virDirCreate callers already use it
This commit is contained in:
parent
c8661a1a7e
commit
9ce409561a
@ -804,7 +804,6 @@ virStorageBackendFileSystemBuild(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
pool->def->target.perms.mode,
|
pool->def->target.perms.mode,
|
||||||
pool->def->target.perms.uid,
|
pool->def->target.perms.uid,
|
||||||
pool->def->target.perms.gid,
|
pool->def->target.perms.gid,
|
||||||
VIR_DIR_CREATE_FORCE_PERMS |
|
|
||||||
VIR_DIR_CREATE_ALLOW_EXIST |
|
VIR_DIR_CREATE_ALLOW_EXIST |
|
||||||
(pool->def->type == VIR_STORAGE_POOL_NETFS
|
(pool->def->type == VIR_STORAGE_POOL_NETFS
|
||||||
? VIR_DIR_CREATE_AS_UID : 0))) < 0) {
|
? VIR_DIR_CREATE_AS_UID : 0))) < 0) {
|
||||||
@ -1075,7 +1074,6 @@ static int createFileDir(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
if ((err = virDirCreate(vol->target.path, vol->target.perms->mode,
|
if ((err = virDirCreate(vol->target.path, vol->target.perms->mode,
|
||||||
vol->target.perms->uid,
|
vol->target.perms->uid,
|
||||||
vol->target.perms->gid,
|
vol->target.perms->gid,
|
||||||
VIR_DIR_CREATE_FORCE_PERMS |
|
|
||||||
(pool->def->type == VIR_STORAGE_POOL_NETFS
|
(pool->def->type == VIR_STORAGE_POOL_NETFS
|
||||||
? VIR_DIR_CREATE_AS_UID : 0))) < 0) {
|
? VIR_DIR_CREATE_AS_UID : 0))) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -2311,8 +2311,7 @@ virDirCreateNoFork(const char *path,
|
|||||||
path, (unsigned int) uid, (unsigned int) gid);
|
path, (unsigned int) uid, (unsigned int) gid);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if ((flags & VIR_DIR_CREATE_FORCE_PERMS)
|
if (chmod(path, mode) < 0) {
|
||||||
&& (chmod(path, mode) < 0)) {
|
|
||||||
ret = -errno;
|
ret = -errno;
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("cannot set mode of '%s' to %04o"),
|
_("cannot set mode of '%s' to %04o"),
|
||||||
@ -2425,8 +2424,7 @@ virDirCreate(const char *path,
|
|||||||
path, (unsigned int) gid);
|
path, (unsigned int) gid);
|
||||||
goto childerror;
|
goto childerror;
|
||||||
}
|
}
|
||||||
if ((flags & VIR_DIR_CREATE_FORCE_PERMS)
|
if (chmod(path, mode) < 0) {
|
||||||
&& chmod(path, mode) < 0) {
|
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("cannot set mode of '%s' to %04o"),
|
_("cannot set mode of '%s' to %04o"),
|
||||||
path, mode);
|
path, mode);
|
||||||
|
@ -223,8 +223,7 @@ int virFileOpenAs(const char *path, int openflags, mode_t mode,
|
|||||||
enum {
|
enum {
|
||||||
VIR_DIR_CREATE_NONE = 0,
|
VIR_DIR_CREATE_NONE = 0,
|
||||||
VIR_DIR_CREATE_AS_UID = (1 << 0),
|
VIR_DIR_CREATE_AS_UID = (1 << 0),
|
||||||
VIR_DIR_CREATE_FORCE_PERMS = (1 << 1),
|
VIR_DIR_CREATE_ALLOW_EXIST = (1 << 1),
|
||||||
VIR_DIR_CREATE_ALLOW_EXIST = (1 << 2),
|
|
||||||
};
|
};
|
||||||
int virDirCreate(const char *path, mode_t mode, uid_t uid, gid_t gid,
|
int virDirCreate(const char *path, mode_t mode, uid_t uid, gid_t gid,
|
||||||
unsigned int flags) ATTRIBUTE_RETURN_CHECK;
|
unsigned int flags) ATTRIBUTE_RETURN_CHECK;
|
||||||
|
Loading…
Reference in New Issue
Block a user