]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virSecuritySELinuxRestoreFileLabel: Adjust code pattern
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 10 Sep 2018 07:55:51 +0000 (09:55 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 18 Sep 2018 15:12:53 +0000 (17:12 +0200)
commit4a7a7808dc44f44d3902d7b8d2c3e929aaa1ec49
tree8acd0ffa0dbf44e629cbe751672aedeacf7cb20e
parentc9318499a7a14a0b7c6832da0141dd23b20bd93c
virSecuritySELinuxRestoreFileLabel: Adjust code pattern

Firstly, the following code pattern is harder to follow:

  if (func() < 0) {
      error();
  } else {
      /* success */
  }

We should put 'goto cleanup' into the error branch and move the
else branch one level up.
Secondly, 'rc' should really be named 'ret' because it holds
return value of the function. Not some intermediate value.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/security/security_selinux.c