1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2024-11-22 16:25:38 +00:00

Not all files will have a symlink

The linkname field in the header might not always
have a value. Need to check empty linkname.

Signed-off-by: Stephen Chung <schung@redhat.com>
This commit is contained in:
Stephen Chung 2016-07-12 09:40:45 -04:00
parent bacbea465f
commit d906a5994a

View file

@ -206,7 +206,10 @@ var (
}
linkKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
if sys, ok := info.Sys().(*tar.Header); ok {
return fmt.Sprintf("link=%s", sys.Linkname), nil
if sys.Linkname != "" {
return fmt.Sprintf("link=%s", sys.Linkname), nil
}
return "", nil
}
if info.Mode()&os.ModeSymlink != 0 {