Refactor process.c to use FNAME_MAX_LEN constant

This commit is contained in:
Themis Demetriades
2024-11-08 15:54:47 +00:00
parent b64434fb9d
commit b866fa88cd

View File

@@ -81,12 +81,12 @@ start_process (void *file_name_)
char *saveptr; char *saveptr;
char *arg = strtok_r (file_name_, " ", &saveptr); char *arg = strtok_r (file_name_, " ", &saveptr);
char file_name[15]; char file_name[FNAME_MAX_LEN + 1];
strlcpy (file_name, arg, 15); strlcpy (file_name, arg, FNAME_MAX_LEN + 1);
/* TODO: Move naming of thread to process_execute, so start /* TODO: Move naming of thread to process_execute, so start
tokenizing there. */ tokenizing there. */
strlcpy (thread_current ()->name, file_name, 15); strlcpy (thread_current ()->name, file_name, FNAME_MAX_LEN + 1);
/* Initialize interrupt frame and load executable. */ /* Initialize interrupt frame and load executable. */
memset (&if_, 0, sizeof if_); memset (&if_, 0, sizeof if_);