1
0
mirror of https://github.com/restic/restic.git synced 2024-06-27 07:55:08 +02:00

remove unused code

This commit is contained in:
Alexander Neumann 2017-04-11 20:08:14 +02:00
parent e6578857cf
commit ccc201ea5f
2 changed files with 0 additions and 38 deletions

View File

@ -20,10 +20,6 @@ import (
"github.com/pkg/sftp"
)
const (
tempfileRandomSuffixLength = 10
)
// SFTP is a backend in a directory accessed via SFTP.
type SFTP struct {
c *sftp.Client
@ -263,38 +259,6 @@ func (r *SFTP) mkdirAll(dir string, mode os.FileMode) error {
return r.c.Chmod(dir, mode)
}
// Rename temp file to final name according to type and name.
func (r *SFTP) renameFile(oldname string, h restic.Handle) error {
filename := r.Filename(h)
// create directories if necessary
if h.Type == restic.DataFile {
err := r.mkdirAll(path.Dir(filename), backend.Modes.Dir)
if err != nil {
return err
}
}
// test if new file exists
if _, err := r.c.Lstat(filename); err == nil {
return errors.Errorf("Close(): file %v already exists", filename)
}
err := r.c.Rename(oldname, filename)
if err != nil {
return errors.Wrap(err, "Rename")
}
// set mode to read-only
fi, err := r.c.Lstat(filename)
if err != nil {
return errors.Wrap(err, "Lstat")
}
err = r.c.Chmod(filename, fi.Mode()&os.FileMode(^uint32(0222)))
return errors.Wrap(err, "Chmod")
}
// Join joins the given paths and cleans them afterwards. This always uses
// forward slashes, which is required by sftp.
func Join(parts ...string) string {

View File

@ -5,8 +5,6 @@ import (
"unicode"
)
const data = `"foo" "bar" baz "test argument" another 'test arg' "last \" argument" 'another \" last argument'`
// shellSplitter splits a command string into separater arguments. It supports
// single and double quoted strings.
type shellSplitter struct {