mirror of
https://github.com/jkl1337/duplicacy.git
synced 2026-06-19 06:40:06 -05:00
Support backup of sockets
This only works on Linux. Darwin does not allow mknod of a socket. Have not tested BSD.
This commit is contained in:
@@ -219,6 +219,23 @@ func (entry *Entry) restoreLateFileFlags(f *os.File) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (entry *Entry) RestoreSpecial(fullPath string) error {
|
||||
mode := entry.Mode & uint32(fileModeMask)
|
||||
|
||||
if entry.Mode&uint32(os.ModeNamedPipe) != 0 {
|
||||
mode |= syscall.S_IFIFO
|
||||
} else if entry.Mode&uint32(os.ModeCharDevice) != 0 {
|
||||
mode |= syscall.S_IFCHR
|
||||
} else if entry.Mode&uint32(os.ModeDevice) != 0 {
|
||||
mode |= syscall.S_IFBLK
|
||||
} else if entry.Mode&uint32(os.ModeSocket) != 0 {
|
||||
mode |= syscall.S_IFSOCK
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
return syscall.Mknod(fullPath, mode, int(entry.GetRdev()))
|
||||
}
|
||||
|
||||
func excludedByAttribute(attributes map[string][]byte) bool {
|
||||
_, ok := attributes["user.duplicacy_exclude"]
|
||||
return ok
|
||||
|
||||
Reference in New Issue
Block a user