Browse Source

agent/proxy: address PR feedback

pull/4275/head
Mitchell Hashimoto 7 years ago
parent
commit
b4ba31c61b
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
  1. 2
      agent/proxy/daemon.go
  2. 4
      agent/proxy/process_unix.go

2
agent/proxy/daemon.go

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

4
agent/proxy/process_unix.go

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