diff --git a/pintos-env/pintos/userprog/process.c b/pintos-env/pintos/userprog/process.c index dd5194e..e90620e 100755 --- a/pintos-env/pintos/userprog/process.c +++ b/pintos-env/pintos/userprog/process.c @@ -59,6 +59,12 @@ process_execute (const char *file_name) } strlcpy(program_name, file_name, i+1); + struct file* f = filesys_open (program_name); + if (f == NULL) { + return TID_ERROR; + } + file_close(f); + /* Create a new thread to execute FILE_NAME. */ tid = thread_create (program_name, PRI_DEFAULT, start_process, fn_copy); if (tid == TID_ERROR)