Ver código fonte

Fix symlinks (fixes #2524)

Audrius Butkevicius 10 anos atrás
pai
commit
4474d200b0
1 arquivos alterados com 3 adições e 1 exclusões
  1. 3 1
      lib/model/sharedpullerstate.go

+ 3 - 1
lib/model/sharedpullerstate.go

@@ -139,7 +139,9 @@ func (s *sharedPullerState) tempFile() (io.WriterAt, error) {
 		return nil, err
 	}
 
-	if s.sparse {
+	// Don't truncate symlink files, as that will mean that the path will
+	// contain a bunch of nulls.
+	if s.sparse && !s.file.IsSymlink() {
 		// Truncate sets the size of the file. This creates a sparse file or a
 		// space reservation, depending on the underlying filesystem.
 		if err := fd.Truncate(s.file.Size()); err != nil {