Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9f464bb

Browse files
committedJun 21, 2015
importer/importer: Check for modes that aren't regular files or directories
For example, we want to crash if we hit a named pipe, not block forever trying to read from it. License: MIT Signed-off-by: W. Trevor King <wking@tremily.us>
1 parent 3a1c8d7 commit 9f464bb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
 

‎importer/importer.go

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ func BuildDagFromFile(fpath string, ds dag.DAGService, mp pin.ManualPinner) (*da
3030
return nil, fmt.Errorf("`%s` is a directory", fpath)
3131
}
3232

33+
if !stat.IsRegular() {
34+
return nil, fmt.Errorf("`%s` is neither a directory nor a file", fpath)
35+
}
36+
3337
f, err := os.Open(fpath)
3438
if err != nil {
3539
return nil, err

0 commit comments

Comments
 (0)
Please sign in to comment.