2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-03 10:28:27 +00:00
restic/vendor/github.com/pkg/sftp/server_statvfs_impl.go

26 lines
535 B
Go
Raw Normal View History

// +build darwin linux
2017-07-23 12:24:45 +00:00
// fill in statvfs structure with OS specific values
// Statfs_t is different per-kernel, and only exists on some unixes (not Solaris for instance)
package sftp
import (
"syscall"
)
2018-09-03 18:23:56 +00:00
func (p sshFxpExtendedPacketStatVFS) respond(svr *Server) responsePacket {
2017-07-23 12:24:45 +00:00
stat := &syscall.Statfs_t{}
if err := syscall.Statfs(p.Path, stat); err != nil {
2018-09-03 18:23:56 +00:00
return statusFromError(p, err)
2017-07-23 12:24:45 +00:00
}
retPkt, err := statvfsFromStatfst(stat)
if err != nil {
2018-09-03 18:23:56 +00:00
return statusFromError(p, err)
2017-07-23 12:24:45 +00:00
}
retPkt.ID = p.ID
2018-09-03 18:23:56 +00:00
return retPkt
2017-07-23 12:24:45 +00:00
}