This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: [libiberty] [PATCH] Fix breakage of pex-djgpp.c in HEAD branch


On Monday 18 April 2005 20:21, you wrote:
> Um, your patch doesn't apply cleanly to the latest pex-djgpp:
>
> $ patch --dry-run < /tmp/foo
> patching file pex-djgpp.c
> Hunk #3 FAILED at 123.
> Hunk #4 FAILED at 170.
> Hunk #5 FAILED at 239.
> 3 out of 5 hunks FAILED -- saving rejects to file pex-djgpp.c.rej

It seems that e-mail program has messed patch up. Resending as attachment
after small fixes to ChangeLog entry.

Andris
2004-04-18  Andris Pavenis  <pavenis@latnet.lv>

	* pex-djgpp.c: Add missing includes.
	(pex_init) Add missing & for last parameter in call to pex_init_common
	(pex_djgpp_exec_child) Use dup(), dup2(), close() instead of _dup(), _dup2(), _close().


Index: gcc/libiberty/pex-djgpp.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/pex-djgpp.c,v
retrieving revision 1.3
diff -u -p -3 -r1.3 pex-djgpp.c
--- gcc/libiberty/pex-djgpp.c	29 Mar 2005 02:08:42 -0000	1.3
+++ gcc/libiberty/pex-djgpp.c	18 Apr 2005 15:18:03 -0000
@@ -30,6 +30,10 @@ extern int errno;
 #include <stdlib.h>
 #endif
 #include <process.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string.h>
 
 /* Use ECHILD if available, otherwise use EINVAL.  */
 #ifdef ECHILD
@@ -68,7 +72,7 @@ pex_init (int flags, const char *pname, 
 {
   /* DJGPP does not support pipes.  */
   flags &= ~ PEX_USE_PIPES;
-  return pex_init_common (flags, pname, tempbase, funcs);
+  return pex_init_common (flags, pname, tempbase, &funcs);
 }
 
 /* Open a file for reading.  */
@@ -119,46 +123,46 @@ pex_djgpp_exec_child (struct pex_obj *ob
 
   if (in != STDIN_FILE_NO)
     {
-      org_in = _dup (STDIN_FILE_NO);
+      org_in = dup (STDIN_FILE_NO);
       if (org_in < 0)
 	{
 	  *err = errno;
-	  *errmsg = "_dup";
+	  *errmsg = "dup";
 	  return -1;
 	}
-      if (_dup2 (in, STDIN_FILE_NO) < 0)
+      if (dup2 (in, STDIN_FILE_NO) < 0)
 	{
 	  *err = errno;
-	  *errmsg = "_dup2";
+	  *errmsg = "dup2";
 	  return -1;
 	}
-      if (_close (in) < 0)
+      if (close (in) < 0)
 	{
 	  *err = errno;
-	  *errmsg = "_close";
+	  *errmsg = "close";
 	  return -1;
 	}
     }
 
   if (out != STDOUT_FILE_NO)
     {
-      org_out = _dup (STDOUT_FILE_NO);
+      org_out = dup (STDOUT_FILE_NO);
       if (org_out < 0)
 	{
 	  *err = errno;
-	  *errmsg = "_dup";
+	  *errmsg = "dup";
 	  return -1;
 	}
-      if (_dup2 (out, STDOUT_FILE_NO) < 0)
+      if (dup2 (out, STDOUT_FILE_NO) < 0)
 	{
 	  *err = errno;
-	  *errmsg = "_dup2";
+	  *errmsg = "dup2";
 	  return -1;
 	}
-      if (_close (out) < 0)
+      if (close (out) < 0)
 	{
 	  *err = errno;
-	  *errmsg = "_close";
+	  *errmsg = "close";
 	  return -1;
 	}
     }
@@ -166,70 +170,68 @@ pex_djgpp_exec_child (struct pex_obj *ob
   if (errdes != STDERR_FILE_NO
       || (flags & PEX_STDERR_TO_STDOUT) != 0)
     {
-      int e;
-
-      org_errdes = _dup (STDERR_FILE_NO);
+      org_errdes = dup (STDERR_FILE_NO);
       if (org_errdes < 0)
 	{
 	  *err = errno;
-	  *errmsg = "_dup";
+	  *errmsg = "dup";
 	  return -1;
 	}
-      if (_dup2 ((flags & PEX_STDERR_TO_STDOUT) != 0 ? STDOUT_FILE_NO : errdes,
+      if (dup2 ((flags & PEX_STDERR_TO_STDOUT) != 0 ? STDOUT_FILE_NO : errdes,
 		 STDERR_FILE_NO) < 0)
 	{
 	  *err = errno;
-	  *errmsg = "_dup2";
+	  *errmsg = "dup2";
 	  return -1;
 	}
       if (errdes != STDERR_FILE_NO)
 	{
-	  if (_close (errdes) < 0)
+	  if (close (errdes) < 0)
 	    {
 	      *err = errno;
-	      *errmsg = "_close";
+	      *errmsg = "close";
 	      return -1;
 	    }
 	}
     }
 
-  status = (((flags & PEX_SEARCH) != 0 ? _spawnvp : _spawnv)
-	    (P_WAIT, program, (const char **) argv));
+  status = (((flags & PEX_SEARCH) != 0 ? spawnvp : spawnv)
+	    (P_WAIT, executable, (const char **) argv));
 
   if (status == -1)
     {
       *err = errno;
-      *errmsg = ((flags & PEX_SEARCH) != 0) ? "_spawnvp" : "_spawnv";
+      *errmsg = ((flags & PEX_SEARCH) != 0) ? "spawnvp" : "spawnv";
     }
 
   if (in != STDIN_FILE_NO)
     {
-      if (_dup2 (org_in, STDIN_FILE_NO) < 0)
+      if (dup2 (org_in, STDIN_FILE_NO) < 0)
 	{
 	  *err = errno;
-	  *errmsg = "_dup2";
+	  *errmsg = "dup2";
 	  return -1;
 	}
-      if (_close (org_in) < 0)
+      if (close (org_in) < 0)
 	{
 	  *err = errno;
-	  *errmsg = "_close";
+	  *errmsg = "close";
 	  return -1;
 	}
     }
 
   if (out != STDOUT_FILE_NO)
     {
-      if (_dup2 (org_out, STDOUT_FILE_NO) < 0)
+      if (dup2 (org_out, STDOUT_FILE_NO) < 0)
 	{
 	  *err = errno;
-	  *errmsg = "_dup2";
+	  *errmsg = "dup2";
 	  return -1;
 	}
-      if (_close (org_out) < 0)
+      if (close (org_out) < 0)
 	{
 	  *err = errno;
-	  *errmsg = "_close";
+	  *errmsg = "close";
 	  return -1;
 	}
     }
@@ -237,16 +239,16 @@ pex_djgpp_exec_child (struct pex_obj *ob
   if (errdes != STDERR_FILE_NO
       || (flags & PEX_STDERR_TO_STDOUT) != 0)
     {
-      if (_dup2 (org_errdes, STDERR_FILE_NO) < 0)
+      if (dup2 (org_errdes, STDERR_FILE_NO) < 0)
 	{
 	  *err = errno;
-	  *errmsg = "_dup2";
+	  *errmsg = "dup2";
 	  return -1;
 	}
-      if (_close (org_errdes) < 0)
+      if (close (org_errdes) < 0)
 	{
 	  *err = errno;
-	  *errmsg = "_close";
+	  *errmsg = "close";
 	  return -1;
 	}
     }

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