Skip to content

Commit

Permalink
tar: Add TypeChar, TypeBlock and TypeFifo header flags support
Browse files Browse the repository at this point in the history
Character devices, block devices and named pipes have the separate
types, but at the same time they can be extracted like the other
files and they're handled well by archive/tar library. Supporting
these headers is necessary for extracting Linux rootfs archives.
  • Loading branch information
Michal Rostecki committed Jan 11, 2017
1 parent 3db6961 commit fa97152
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tar.go
Expand Up @@ -204,7 +204,7 @@ func untarFile(tr *tar.Reader, header *tar.Header, destination string) error {
switch header.Typeflag {
case tar.TypeDir:
return mkdir(filepath.Join(destination, header.Name))
case tar.TypeReg, tar.TypeRegA:
case tar.TypeReg, tar.TypeRegA, tar.TypeChar, tar.TypeBlock, tar.TypeFifo:
return writeNewFile(filepath.Join(destination, header.Name), tr, header.FileInfo().Mode())
case tar.TypeSymlink:
return writeNewSymbolicLink(filepath.Join(destination, header.Name), header.Linkname)
Expand Down

0 comments on commit fa97152

Please sign in to comment.