go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/providers/os/connection/local_unix.go (about) 1 // Copyright (c) Mondoo, Inc. 2 // SPDX-License-Identifier: BUSL-1.1 3 4 //go:build !windows 5 // +build !windows 6 7 package connection 8 9 import ( 10 "os" 11 "syscall" 12 13 "go.mondoo.com/cnquery/providers/os/connection/shared" 14 ) 15 16 func (c *LocalConnection) fileowner(stat os.FileInfo) (int64, int64) { 17 uid := int64(-1) 18 gid := int64(-1) 19 if stat, ok := stat.Sys().(*shared.FileInfo); ok { 20 uid = stat.Uid 21 gid = stat.Gid 22 } 23 if stat, ok := stat.Sys().(*syscall.Stat_t); ok { 24 uid = int64(stat.Uid) 25 gid = int64(stat.Gid) 26 } 27 return uid, gid 28 }