// architectures. If a large value is encountered when decoding, the result
// stored in Header will be the truncated version.
+var (
+ ErrHeader = errors.New("tar: invalid tar header")
+ ErrWriteTooLong = errors.New("tar: write too long")
+ ErrFieldTooLong = errors.New("tar: header field too long")
+ ErrWriteAfterClose = errors.New("tar: write after close")
+)
+
// Header type flags.
const (
TypeReg = '0' // regular file
case fm&os.ModeNamedPipe != 0:
h.Typeflag = TypeFifo
case fm&os.ModeSocket != 0:
- return nil, fmt.Errorf("archive/tar: sockets not supported")
+ return nil, fmt.Errorf("tar: sockets not supported")
default:
- return nil, fmt.Errorf("archive/tar: unknown file mode %v", fm)
+ return nil, fmt.Errorf("tar: unknown file mode %v", fm)
}
if fm&os.ModeSetuid != 0 {
h.Mode |= c_ISUID
import (
"bytes"
- "errors"
"io"
"io/ioutil"
"math"
"time"
)
-var (
- ErrHeader = errors.New("archive/tar: invalid tar header")
-)
-
// A Reader provides sequential access to the contents of a tar archive.
// A tar archive consists of a sequence of files.
// The Next method advances to the next file in the archive (including the first),
import (
"bytes"
- "errors"
"fmt"
"io"
"path"
"time"
)
-var (
- ErrWriteTooLong = errors.New("archive/tar: write too long")
- ErrFieldTooLong = errors.New("archive/tar: header field too long")
- ErrWriteAfterClose = errors.New("archive/tar: write after close")
- errInvalidHeader = errors.New("archive/tar: header field too long or contains invalid values")
-)
-
// A Writer provides sequential writing of a tar archive in POSIX.1 format.
// A tar archive consists of a sequence of files.
// Call WriteHeader to begin a new file, and then call Write to supply that file's data,
// will implicitly flush out the file's padding.
func (tw *Writer) Flush() error {
if tw.nb > 0 {
- tw.err = fmt.Errorf("archive/tar: missed writing %d bytes", tw.nb)
+ tw.err = fmt.Errorf("tar: missed writing %d bytes", tw.nb)
return tw.err
}
if _, tw.err = tw.w.Write(zeroBlock[:tw.pad]); tw.err != nil {