timens: minor cleanups

Fix up a few things that were flagged in the review of the original
timens PR, namely around error handling and validation.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
This commit is contained in:
Aleksa Sarai
2023-08-10 18:32:24 +10:00
parent 0866112e81
commit 9acfd7b1a3
4 changed files with 10 additions and 14 deletions
@@ -120,6 +120,10 @@ func namespaces(config *configs.Config) error {
if _, err := os.Stat("/proc/self/timens_offsets"); os.IsNotExist(err) {
return errors.New("time namespaces aren't enabled in the kernel")
}
} else {
if config.TimeOffsets != nil {
return errors.New("time namespace offsets specified, but time namespace isn't enabled in the config")
}
}
return nil