mountedDirGID reads the numeric GID of a mounted directory.
(path string)
| 11 | |
| 12 | // mountedDirGID reads the numeric GID of a mounted directory. |
| 13 | func mountedDirGID(path string) (string, error) { |
| 14 | info, err := os.Stat(path) |
| 15 | if err != nil { |
| 16 | return "", fmt.Errorf("failed to stat mounted NFS dir %q -> %w", path, err) |
| 17 | } |
| 18 | |
| 19 | stat, ok := info.Sys().(*syscall.Stat_t) |
| 20 | if !ok { |
| 21 | return "", fmt.Errorf("failed to read numeric gid for mounted NFS dir %q", path) |
| 22 | } |
| 23 | |
| 24 | return strconv.FormatUint(uint64(stat.Gid), 10), nil |
| 25 | } |