Index: mono/io-layer/processes.c
===================================================================
RCS file: /mono/mono/mono/io-layer/processes.c,v
retrieving revision 1.11
diff -u -r1.11 processes.c
--- mono/io-layer/processes.c	21 Feb 2003 13:22:10 -0000	1.11
+++ mono/io-layer/processes.c	28 Feb 2003 00:42:12 -0000
@@ -20,6 +20,7 @@
 #include <errno.h>
 #include <sys/types.h>
 #include <unistd.h>
+#include <sys/stat.h>
 
 #include <mono/io-layer/wapi.h>
 #include <mono/io-layer/unicode.h>
@@ -89,13 +90,14 @@
 			WapiStartupInfo *startup,
 			WapiProcessInformation *process_info)
 {
-	gchar *cmd=NULL, *prog, *full_prog, *args=NULL, *args_after_prog=NULL, *dir=NULL;
+	gchar *cmd=NULL, *prog = NULL, *full_prog = NULL, *args=NULL, *args_after_prog=NULL, *dir=NULL;
 	guint32 env=0, stored_dir=0, stored_prog=0, i;
 	gboolean ret=FALSE;
 	gpointer stdin_handle, stdout_handle, stderr_handle;
 	guint32 pid, tid;
 	gpointer process_handle, thread_handle;
-	
+	struct stat file_stat;
+
 	mono_once (&process_ops_once, process_ops_init);
 	
 	/* appname and cmdline specify the executable and its args:
@@ -328,6 +330,19 @@
 		if(token[0]=='/') {
 			/* Assume full path given */
 			prog=g_strdup (token);
+
+			ret=stat (prog, &file_stat);
+			
+			/* Executable existing ? */
+			if(access (prog, X_OK) != 0 || (ret == 0 && S_ISDIR(file_stat.st_mode)) ) {
+				g_free (prog);
+#ifdef DEBUG
+				g_message (G_GNUC_PRETTY_FUNCTION ": Couldn't find executable %s", token);
+#endif
+				g_free (token);
+				goto cleanup;
+			}
+
 		} else {
 			char *curdir=g_get_current_dir ();
 
@@ -340,10 +355,12 @@
 			prog=g_strdup_printf ("%s/%s", curdir, token);
 			g_free (curdir);
 
+			ret=stat (prog, &file_stat);
+
 			/* I assume X_OK is the criterion to use,
 			 * rather than F_OK
 			 */
-			if(access (prog, X_OK)!=0) {
+			if(access(prog, X_OK) != 0 || (ret == 0 && S_ISDIR(file_stat.st_mode)) ) {
 				g_free (prog);
 				prog=g_find_program_in_path (token);
 				if(prog==NULL) {
