Fix a potential issue in utils.CreatePidFile where Atoi's error state was not being handled properly.

The stat line? It’s unchanged.

-Erik

> On Jul 30, 2014, at 10:55 AM, Alexandr Morozov <notifications@github.com> wrote:
> 
> In utils/daemon.go:
> 
> > @@ -11,10 +11,12 @@ import (
> >  func CreatePidFile(pidfile string) error {
> >  	if pidString, err := ioutil.ReadFile(pidfile); err == nil {
> >  		pid, err := strconv.Atoi(string(pidString))
> > -		if err == nil {
> > -			if _, err := os.Stat(fmt.Sprintf("/proc/%d/", pid)); err == nil {
> > -				return fmt.Errorf("pid file found, ensure docker is not running or delete %s", pidfile)
> > -			}
> > +		if err != nil {
> > +			return fmt.Errorf("Internal Error creating pidfile: %s", err.Error())
> > +		}
> > +
> > +		if _, err := os.Stat(fmt.Sprintf("/proc/%d/", pid)); err == nil {
> Shouldn't this be !os.IsNotExist(err)?
> 
> —
> Reply to this email directly or view it on GitHub.
>