Log info message when unable to chown file #1521

This commit is contained in:
Mike Farah
2023-01-15 11:36:52 +11:00
parent ec40a1a08a
commit 473be23153
2 changed files with 12 additions and 1 deletions
+8 -1
View File
@@ -12,7 +12,14 @@ func changeOwner(info fs.FileInfo, file *os.File) error {
if stat, ok := info.Sys().(*syscall.Stat_t); ok {
uid := int(stat.Uid)
gid := int(stat.Gid)
return os.Chown(file.Name(), uid, gid)
err := os.Chown(file.Name(), uid, gid)
if err != nil {
// this happens with snap confinement
// not really a big issue as users can chown
// the file themselves if required.
log.Info("Skipping chown: %v", err)
}
}
return nil
}