backup: Convert relative pathname for --stdin-filename to absolute (#2063)

This commit is contained in:
Garry McNulty 2019-04-28 20:59:35 +01:00 committed by Alexander Neumann
parent 8066195e6e
commit 4429a66b5f
1 changed files with 4 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"os" "os"
"path"
"path/filepath" "path/filepath"
"strconv" "strconv"
"strings" "strings"
@ -523,13 +524,14 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, term *termstatus.Termina
if !gopts.JSON { if !gopts.JSON {
p.V("read data from stdin") p.V("read data from stdin")
} }
filename := path.Join("/", opts.StdinFilename)
targetFS = &fs.Reader{ targetFS = &fs.Reader{
ModTime: timeStamp, ModTime: timeStamp,
Name: opts.StdinFilename, Name: filename,
Mode: 0644, Mode: 0644,
ReadCloser: os.Stdin, ReadCloser: os.Stdin,
} }
targets = []string{opts.StdinFilename} targets = []string{filename}
} }
sc := archiver.NewScanner(targetFS) sc := archiver.NewScanner(targetFS)