This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] gdbserver, errno handling in my_waitpid


This is not really my most familiar bit of the code, so
you gdbserver guys check me, ok?

It seems to me that we need to set errno to zero before calling waitpid,
if we're going to check it right after.  Especially the second time.

2010-03-10  Michael Snyder  <msnyder@vmware.com>

	* linux-low.c (my_waitpid): Set errno to 0 before waitpid.

Index: linux-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v
retrieving revision 1.130
diff -u -p -r1.130 linux-low.c
--- linux-low.c	6 Mar 2010 00:11:42 -0000	1.130
+++ linux-low.c	10 Mar 2010 21:20:14 -0000
@@ -309,6 +309,7 @@ my_waitpid (int pid, int *status, int fl
 	{
 	  /* Since all signals are blocked, there's no need to check
 	     for EINTR here.  */
+	  errno = 0;
 	  ret = waitpid (pid, status, flags);
 	  out_errno = errno;
 
@@ -338,6 +339,7 @@ my_waitpid (int pid, int *status, int fl
     }
   else
     {
+      errno = 0;
       do
 	ret = waitpid (pid, status, flags);
       while (ret == -1 && errno == EINTR);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]