GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — locks/metadata_linux.go at master · asciimoth/locks Expand file tree/ Copy pathmetadata_linux.goMore file actions 42 lines (37 loc) · 1.13 KB / Copy pathmetadata_linux.goFile metadata and controls42 lines (37 loc) · 1.13 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 //go:build linux package locks import ( "errors" "os" "golang.org/x/sys/unix" ) // setMetadata preserves ownership, access modes and Linux extended attributes, // including POSIX ACLs. A failure leaves the live leaf in place. func setMetadata(src, dst *os.File, mode uint32, dir bool) error { if src == nil { return setOwnerMode(nil, dst, mode) } // Creation can inherit an ACL that the source did not have. Remove it // before chmod can activate its masked permissions, then copy source ACLs. for _, name := range []string{"system.posix_acl_access", "system.posix_acl_default"} { e := xattrs.Fremovexattr(int(dst.Fd()), name) if e != nil && !errors.Is(e, unix.ENODATA) && !errors.Is(e, unix.ENOTSUP) { return e } } if err := setOwnerMode(src, dst, mode); err != nil { return err } return copyXattrs(src, dst, dir) } func skipXattr(string) bool { return false } func prepareXattr(name string, v []byte, dir bool) { if name == "system.posix_acl_access" && dir { // Linux ACL xattrs have a four-byte header and eight-byte entries. for i := 4; i+8 <= len(v); i += 8 { if v[i+2]&4 != 0 { v[i+2] |= 1 } } } } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |