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 |
#ifdef HAVE_SYS_STAT_H |
261 |
struct stat st; |
262 |
#endif |
257 |
if (endp == startp) |
263 |
if (endp == startp) |
258 |
{ |
264 |
{ |
259 |
nstore[0] = '.'; |
265 |
nstore[0] = '.'; |
Lines 271-280
Link Here
|
271 |
else |
277 |
else |
272 |
nstore[endp - startp] = 0; |
278 |
nstore[endp - startp] = 0; |
273 |
} |
279 |
} |
|
|
280 |
|
274 |
strcat (nstore, progname); |
281 |
strcat (nstore, progname); |
275 |
if (! access (nstore, X_OK) |
282 |
if (( |
|
|
283 |
#ifdef HAVE_SYS_STAT_H |
284 |
! stat(nstore, &st) && S_ISREG (st.st_mode) && |
285 |
#endif |
286 |
! access (nstore, X_OK)) |
276 |
#ifdef HAVE_HOST_EXECUTABLE_SUFFIX |
287 |
#ifdef HAVE_HOST_EXECUTABLE_SUFFIX |
277 |
|| ! access (strcat (nstore, HOST_EXECUTABLE_SUFFIX), X_OK) |
288 |
|| (! access (strcat (nstore, HOST_EXECUTABLE_SUFFIX), X_OK) |
|
|
289 |
#ifdef HAVE_SYS_STAT_H |
290 |
&& ! stat (nstore) && S_ISREG (st.st_mode) |
291 |
#endif |
292 |
) |
278 |
#endif |
293 |
#endif |
279 |
) |
294 |
) |
280 |
{ |
295 |
{ |