mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #46786 from twangboy/fix_46757
Return int(-1) when pidfile contains invalid data
This commit is contained in:
commit
f1be939763
2 changed files with 5 additions and 4 deletions
|
@ -35,6 +35,7 @@ import salt.utils.args
|
|||
import salt.utils.xdg
|
||||
import salt.utils.jid
|
||||
import salt.utils.files
|
||||
import salt.utils.win_functions
|
||||
from salt.utils import kinds
|
||||
from salt.defaults import DEFAULT_TARGET_DELIM
|
||||
from salt.utils.validate.path import is_writeable
|
||||
|
@ -1017,11 +1018,11 @@ class DaemonMixIn(six.with_metaclass(MixInMeta, object)):
|
|||
if self.check_pidfile():
|
||||
pid = self.get_pidfile()
|
||||
if not salt.utils.is_windows():
|
||||
if self.check_pidfile() and self.is_daemonized(pid) and not os.getppid() == pid:
|
||||
if self.check_pidfile() and self.is_daemonized(pid) and os.getppid() != pid:
|
||||
return True
|
||||
else:
|
||||
# We have no os.getppid() on Windows. Best effort.
|
||||
if self.check_pidfile() and self.is_daemonized(pid):
|
||||
# We have no os.getppid() on Windows. Use salt.utils.win_functions.get_parent_pid
|
||||
if self.check_pidfile() and self.is_daemonized(pid) and salt.utils.win_functions.get_parent_pid() != pid:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ def get_pidfile(pidfile):
|
|||
pid = pdf.read().strip()
|
||||
return int(pid)
|
||||
except (OSError, IOError, TypeError, ValueError):
|
||||
return None
|
||||
return -1
|
||||
|
||||
|
||||
def clean_proc(proc, wait_for_kill=10):
|
||||
|
|
Loading…
Add table
Reference in a new issue