mozilla-services/heka — pull request #440 by mattcottingham (2013-09-25 13:26:06+00:00)
Title: Fix panic when an invalid config file path is specified

Currently the errors from os.Open() and Stat() are not checked, so a panic results when an invalid config file path is specified:

```
$ ./hekad -config="invalid"
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x409fb9]

goroutine 1 [running]:
runtime.panic(0x7d2880, 0xee4fe8)
/usr/local/src/go/src/pkg/runtime/panic.c:266 +0xb6
main.LoadHekadConfig(0x7ffffc15f1f0, 0x7, 0xc21007eb60, 0x7ff42e9bb000, 0xc2100380c0)
/home/matt/dev/go/src/github.com/mozilla-services/heka/build/heka/src/github.com/mozilla-services/heka/cmd/hekad/config.go:64 +0x1b9
main.main()
/home/matt/dev/go/src/github.com/mozilla-services/heka/build/heka/src/github.com/mozilla-services/heka/cmd/hekad/main.go:91 +0x22e

goroutine 3 [syscall]:
os/signal.loop()
/usr/local/src/go/src/pkg/os/signal/signal_unix.go:21 +0x1e
created by os/signal.init·1
/usr/local/src/go/src/pkg/os/signal/signal_unix.go:27 +0x31

```

This fixes the panic so it returns a more user-friendly error:

```
$ ./hekad -config="invalid"
2013/09/25 14:25:46 Error reading config: Error opening config file: open invalid: no such file or directory
```