Always release filesys_lock when checking if file is valid in process_execute
This commit is contained in:
@@ -87,9 +87,10 @@ process_execute (const char *cmd)
|
|||||||
might be necessary. */
|
might be necessary. */
|
||||||
lock_acquire (&filesys_lock);
|
lock_acquire (&filesys_lock);
|
||||||
/* Validates that the current file to be executed is a valid file */
|
/* Validates that the current file to be executed is a valid file */
|
||||||
if (filesys_open (file_name) == NULL)
|
bool valid_file = filesys_open (file_name) != NULL;
|
||||||
return TID_ERROR;
|
|
||||||
lock_release (&filesys_lock);
|
lock_release (&filesys_lock);
|
||||||
|
if (!valid_file)
|
||||||
|
return TID_ERROR;
|
||||||
|
|
||||||
/* Create a new thread to execute the command, by initializing
|
/* Create a new thread to execute the command, by initializing
|
||||||
it running the function 'start_process' with the appropriate
|
it running the function 'start_process' with the appropriate
|
||||||
|
|||||||
Reference in New Issue
Block a user