agent/proxy: address PR feedback

This commit is contained in:
Mitchell Hashimoto 2018-05-04 08:09:44 -07:00
parent 7bb13246a8
commit a89238a9d3
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
2 changed files with 3 additions and 3 deletions

View File

@ -284,6 +284,7 @@ func (p *Daemon) Stop() error {
// used only for tests.
func (p *Daemon) stopKeepAlive() error {
p.lock.Lock()
defer p.lock.Unlock()
// If we're already stopped or never started, then no problem.
if p.stopped || p.process == nil {
@ -295,7 +296,6 @@ func (p *Daemon) stopKeepAlive() error {
// Note that we've stopped
p.stopped = true
close(p.stopCh)
p.lock.Unlock()
return nil
}

View File

@ -22,9 +22,9 @@ func findProcess(pid int) (*os.Process, error) {
// a 0 signal. This will do nothing to the process but will still
// return errors if the process is gone.
err = p.Signal(syscall.Signal(0))
if err == nil || err == syscall.EPERM {
if err == nil {
return p, nil
}
return nil, fmt.Errorf("process is dead")
return nil, fmt.Errorf("process %d is dead or running as another user", pid)
}