mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
storage: createFileDir: use less ternary operators
Introduce separate variables and if conditions with spaces around them to make the function call easier to read. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
7b100461a4
commit
327580ff6b
@ -1997,6 +1997,8 @@ createFileDir(virStoragePoolObjPtr pool,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
||||||
|
mode_t permmode = VIR_STORAGE_DEFAULT_VOL_PERM_MODE;
|
||||||
|
unsigned int createflags = 0;
|
||||||
|
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
@ -2013,15 +2015,17 @@ createFileDir(virStoragePoolObjPtr pool,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vol->target.perms->mode != (mode_t)-1)
|
||||||
|
permmode = vol->target.perms->mode;
|
||||||
|
|
||||||
|
if (def->type == VIR_STORAGE_POOL_NETFS)
|
||||||
|
createflags |= VIR_DIR_CREATE_AS_UID;
|
||||||
|
|
||||||
if (virDirCreate(vol->target.path,
|
if (virDirCreate(vol->target.path,
|
||||||
(vol->target.perms->mode == (mode_t)-1 ?
|
permmode,
|
||||||
VIR_STORAGE_DEFAULT_VOL_PERM_MODE :
|
|
||||||
vol->target.perms->mode),
|
|
||||||
vol->target.perms->uid,
|
vol->target.perms->uid,
|
||||||
vol->target.perms->gid,
|
vol->target.perms->gid,
|
||||||
(def->type == VIR_STORAGE_POOL_NETFS
|
createflags) < 0) {
|
||||||
? VIR_DIR_CREATE_AS_UID : 0)) < 0) {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user