Commit e63c2e35 authored by unknown's avatar unknown
Browse files

Merge pilot.blaudden:/home/msvensson/mysql/mysql-4.1-maint

into  pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint


mysql-test/lib/mtr_process.pl:
  Auto merged
parents aff6a36e e40bcac0
Loading
Loading
Loading
Loading
+20 −9
Original line number Diff line number Diff line
@@ -139,19 +139,18 @@ sub spawn_impl ($$$$$$$$) {
    {
      if ( $! == $!{EAGAIN} )           # See "perldoc Errno"
      {
        mtr_debug("Got EAGAIN from fork(), sleep 1 second and redo");
        mtr_warning("Got EAGAIN from fork(), sleep 1 second and redo");
        sleep(1);
        redo FORK;
      }
      else
      {
        mtr_error("$path ($pid) can't be forked");
      }

      mtr_error("$path ($pid) can't be forked, error: $!");

    }

    if ( $pid )
    {
      spawn_parent_impl($pid,$mode,$path);
      return spawn_parent_impl($pid,$mode,$path);
    }
    else
    {
@@ -216,8 +215,11 @@ sub spawn_impl ($$$$$$$$) {
      {
        mtr_child_error("failed to execute \"$path\": $!");
      }
      mtr_error("Should never come here 1!");
    }
    mtr_error("Should never come here 2!");
  }
  mtr_error("Should never come here 3!");
}


@@ -230,12 +232,21 @@ sub spawn_parent_impl {
  {
    if ( $mode eq 'run' )
    {
      # Simple run of command, we wait for it to return
      # Simple run of command, wait blocking for it to return
      my $ret_pid= waitpid($pid,0);
      if ( $ret_pid != $pid )
      {
        mtr_error("waitpid($pid, 0) returned $ret_pid " .
		  "when waiting for '$path'");
	# The "simple" waitpid has failed, print debug info
	# and try to handle the error
        mtr_warning("waitpid($pid, 0) returned $ret_pid " .
		    "when waiting for '$path', error: '$!'");
	if ( $ret_pid == -1 )
	{
	  # waitpid returned -1, that would indicate the process
	  # no longer exist and waitpid couldn't wait for it.
	  return 1;
	}
	mtr_error("Error handling failed");
      }

      return mtr_process_exit_status($?);