MCPcopy
hub / github.com/syncthing/syncthing / syncOwnership

Method syncOwnership

lib/model/folder_sendrecv_windows.go:17–31  ·  view source on GitHub ↗
(file *protocol.FileInfo, path string)

Source from the content-addressed store, hash-verified

15)
16
17func (f *sendReceiveFolder) syncOwnership(file *protocol.FileInfo, path string) error {
18 if file.Platform.Windows == nil || file.Platform.Windows.OwnerName == "" {
19 // No owner data, nothing to do
20 return nil
21 }
22
23 l.Debugf("Owner name for %s is %s (group=%v)", path, file.Platform.Windows.OwnerName, file.Platform.Windows.OwnerIsGroup)
24 usid, gsid, err := lookupUserAndGroup(file.Platform.Windows.OwnerName, file.Platform.Windows.OwnerIsGroup)
25 if err != nil {
26 return err
27 }
28
29 l.Debugf("Owner for %s resolved to uid=%q gid=%q", path, usid, gsid)
30 return f.mtimefs.Lchown(path, usid, gsid)
31}
32
33func lookupUserAndGroup(name string, group bool) (string, string, error) {
34 // Look up either the the user or the group, returning the other kind as

Callers

nothing calls this directly

Calls 3

lookupUserAndGroupFunction · 0.85
DebugfMethod · 0.80
LchownMethod · 0.65

Tested by

no test coverage detected