View | Details | Raw Unified | Return to bug 38966 | Differences between
and this patch

Collapse All | Expand All

(-)gcc-4.3.2-clean/libiberty/make-relative-prefix.c (-2 / +7 lines)
Lines 57-62 Link Here
57
#ifdef HAVE_UNISTD_H
57
#ifdef HAVE_UNISTD_H
58
#include <unistd.h>
58
#include <unistd.h>
59
#endif
59
#endif
60
#ifdef HAVE_SYS_STAT_H
61
#include <sys/stat.h>
62
#endif
60
63
61
#include <string.h>
64
#include <string.h>
62
65
Lines 254-259 Link Here
254
	    {
257
	    {
255
	      if (*endp == PATH_SEPARATOR || *endp == 0)
258
	      if (*endp == PATH_SEPARATOR || *endp == 0)
256
		{
259
		{
260
		  struct stat st;
257
		  if (endp == startp)
261
		  if (endp == startp)
258
		    {
262
		    {
259
		      nstore[0] = '.';
263
		      nstore[0] = '.';
Lines 271-280 Link Here
271
		      else
275
		      else
272
			nstore[endp - startp] = 0;
276
			nstore[endp - startp] = 0;
273
		    }
277
		    }
278
274
		  strcat (nstore, progname);
279
		  strcat (nstore, progname);
275
		  if (! access (nstore, X_OK)
280
		  if ((! stat(nstore, &st) && S_ISREG (st.st_mode) && ! access (nstore, X_OK))
276
#ifdef HAVE_HOST_EXECUTABLE_SUFFIX
281
#ifdef HAVE_HOST_EXECUTABLE_SUFFIX
277
                      || ! access (strcat (nstore, HOST_EXECUTABLE_SUFFIX), X_OK)
282
                      || (! stat (strcat (nstore, HOST_EXECUTABLE_SUFFIX)) && S_ISREG (st.st_mode) && ! access (nstore, X_OK))
278
#endif
283
#endif
279
		      )
284
		      )
280
		    {
285
		    {

Return to bug 38966