agent/proxy: address PR feedback

pull/4275/head
Mitchell Hashimoto 7 years ago
parent f5e7993249
commit b4ba31c61b
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A

@ -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
}

@ -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)
}

Loading…
Cancel
Save