From 344f13d6f1a774ef15f7c62f88cb58ed5bca9a7f Mon Sep 17 00:00:00 2001
From: unknown <jimw@mysql.com>
Date: Wed, 8 Jun 2005 18:57:39 -0700
Subject: [PATCH] Make sure we don't mistake a "grep mysqld" for a mysqld
 process when checking if the server is running in mysqld_safe. (Bug #11122)

configure.in:
  Add "grep -v grep" to FIND_PROC so we don't mistake "grep mysqld"
  for a mysqld process.
---
 configure.in | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/configure.in b/configure.in
index e685e811c2..d454d23b38 100644
--- a/configure.in
+++ b/configure.in
@@ -501,33 +501,33 @@ PS=$ac_cv_path_PS
 # Linux style
 if $PS p $$ 2> /dev/null | grep $0 > /dev/null
 then
-  FIND_PROC="$PS p \$\$PID | grep mysqld > /dev/null"
+  FIND_PROC="$PS p \$\$PID | grep -v grep | grep mysqld > /dev/null"
 # Solaris
 elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
 then
-  FIND_PROC="$PS -p \$\$PID | grep mysqld > /dev/null"
+  FIND_PROC="$PS -p \$\$PID | grep -v grep | grep mysqld > /dev/null"
 # BSD style
 elif $PS -uaxww 2> /dev/null | grep $0 > /dev/null
 then
-  FIND_PROC="$PS -uaxww | grep mysqld | grep \" \$\$PID \" > /dev/null"
+  FIND_PROC="$PS -uaxww | grep -v grep | grep mysqld | grep \" \$\$PID \" > /dev/null"
 # SysV style
 elif $PS -ef 2> /dev/null | grep $0 > /dev/null
 then
-  FIND_PROC="$PS -ef | grep mysqld | grep \" \$\$PID \" > /dev/null"
+  FIND_PROC="$PS -ef | grep -v grep | grep mysqld | grep \" \$\$PID \" > /dev/null"
 # Do anybody use this?
 elif $PS $$ 2> /dev/null | grep $0 > /dev/null
 then
-  FIND_PROC="$PS \$\$PID | grep mysqld > /dev/null"
+  FIND_PROC="$PS \$\$PID | grep -v grep | grep mysqld > /dev/null"
 else
   case $SYSTEM_TYPE in
     *freebsd*)
-      FIND_PROC="$PS p \$\$PID | grep mysqld > /dev/null"
+      FIND_PROC="$PS p \$\$PID | grep -v grep | grep mysqld > /dev/null"
       ;;
     *darwin*)
-      FIND_PROC="$PS -uaxww | grep mysqld | grep \" \$\$PID \" > /dev/null"
+      FIND_PROC="$PS -uaxww | grep -v grep | grep mysqld | grep \" \$\$PID \" > /dev/null"
       ;;
     *cygwin*)
-      FIND_PROC="$PS -e | grep mysqld | grep \" \$\$PID \" > /dev/null"
+      FIND_PROC="$PS -e | grep -v grep | grep mysqld | grep \" \$\$PID \" > /dev/null"
       ;;
     *netware* | *modesto*)
       FIND_PROC=
-- 
2.30.9