Skip to content

Commit

Permalink
Ensure that we can handle transient selinux errors
Browse files Browse the repository at this point in the history
In case that setting the fcontext succeeded but calling restorecon
failed, it was possible that we continue with the handler startup,
although the directory is not correctly labeled.
  • Loading branch information
rmohr committed Aug 7, 2019
1 parent 61a58e1 commit 2fc1b0c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions cmd/virt-handler/virt-handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,13 @@ func (app *virtHandlerApp) Run() {
for _, dir := range []string{app.VirtShareDir, app.VirtLibDir} {
if labeled, err := se.IsLabeled(dir); err != nil {
panic(err)
} else if labeled {
continue
} else if !labeled {
err := se.Label("container_file_t", dir)
if err != nil {
panic(err)
}
}
err := se.Label("container_file_t", dir)
if err != nil {
panic(err)
}
err = se.Restore(dir)
err := se.Restore(dir)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 2fc1b0c

Please sign in to comment.