Add more error reporting

This commit is contained in:
Alexander Neumann 2015-03-21 14:43:33 +01:00
parent 865d315ad6
commit aca0692ee6
2 changed files with 20 additions and 4 deletions

View file

@ -11,10 +11,10 @@ import (
"github.com/restic/restic/debug"
)
func (node *Node) fill_extra(path string, fi os.FileInfo) (err error) {
func (node *Node) fill_extra(path string, fi os.FileInfo) error {
stat, ok := fi.Sys().(*syscall.Stat_t)
if !ok {
return
return nil
}
node.ChangeTime = time.Unix(stat.Ctim.Unix())
@ -23,7 +23,7 @@ func (node *Node) fill_extra(path string, fi os.FileInfo) (err error) {
node.GID = stat.Gid
// TODO: cache uid lookup
if u, nil := user.LookupId(strconv.Itoa(int(stat.Uid))); err == nil {
if u, err := user.LookupId(strconv.Itoa(int(stat.Uid))); err == nil {
node.User = u.Username
}
@ -34,6 +34,8 @@ func (node *Node) fill_extra(path string, fi os.FileInfo) (err error) {
node.Inode = stat.Ino
var err error
switch node.Type {
case "file":
node.Size = uint64(stat.Size)