From 3640223220e274df61ef0b035a753bbe213ea1c4 Mon Sep 17 00:00:00 2001 From: Junjie Qian Date: Thu, 30 Mar 2017 11:19:19 -0700 Subject: [PATCH] FileHandleWriter: Add error handling to stagedir creation --- FileHandleWriter.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/FileHandleWriter.go b/FileHandleWriter.go index d72da25..d0848df 100644 --- a/FileHandleWriter.go +++ b/FileHandleWriter.go @@ -35,7 +35,10 @@ func NewFileHandleWriter(handle *FileHandle, newFile bool) (*FileHandleWriter, e w.Close() } stageDir := "/var/hdfs-mount" // TODO: make configurable - os.MkdirAll(stageDir, 0700) + if ok := os.MkdirAll(stageDir, 0700); ok != nil { + Error.Println("Failed to create stageDir /var/hdfs-mount, Error:", ok) + return nil, ok + } var err error this.stagingFile, err = ioutil.TempFile(stageDir, "stage") if err != nil {