Skip to content

Commit

Permalink
Handle re-used pids in pidfile_is_running
Browse files Browse the repository at this point in the history
Since pids can be re-used, it is necessary to check that the
process that is running with a pid matches the one that we expect.

This adds the ability to optionally pass a 'binary' argument to
pidfile_is_running, and if it is passed to match the binary against
/proc/$pid/exe.

Signed-off-by: Terry Wilson <twilson@redhat.com>
Signed-off-by: Mark Michelson <mmichels@redhat.com>
Acked-by: Ihar Hrachyshka <ihrachys@redhat.com>
Acked-by: Mark Michelson <mmichels@redhat.com>
  • Loading branch information
otherwiseguy authored and putnopvut committed Jun 9, 2022
1 parent ef11228 commit 1180022
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion utilities/ovn-ctl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ ovn_ic_db_conf_file="$ovn_etcdir/ovn-ic-db-params.conf"

pidfile_is_running () {
pidfile=$1
test -e "$pidfile" && [ -s "$pidfile" ] && pid=`cat "$pidfile"` && pid_exists "$pid"
cmd=$2
test -e "$pidfile" && [ -s "$pidfile" ] && pid=`cat "$pidfile"` && pid_exists "$pid" && [ -z $cmd -o pid_comm_check "$cmd" "$pid" ]
} >/dev/null 2>&1

stop_nb_ovsdb() {
Expand Down

0 comments on commit 1180022

Please sign in to comment.