tarfeef101 6 anni fa
parent
commit
23af2b9c19

BIN
kern/compile/ASST2/kernel


+ 1 - 1
kern/compile/ASST2/vers.c

@@ -1,3 +1,3 @@
 /* This file is automatically generated. Edits will be lost.*/
-const int buildversion = 245;
+const int buildversion = 248;
 const char buildconfig[] = "ASST2";

+ 1 - 1
kern/compile/ASST2/version

@@ -1 +1 @@
-245
+248

+ 1 - 16
kern/syscall/proc_syscalls.c

@@ -250,7 +250,7 @@ int sys_execv(const char * program, userptr_t args)
   }
 
   // allocate space for filepath
-  char * filepath = kmalloc(sizeof(program));
+  char * filepath = kmalloc((strlen(program) + 1) * sizeof(char));
   if (!(filepath))
   {
     freeArgv(argv, argcount - 1);
@@ -259,23 +259,8 @@ int sys_execv(const char * program, userptr_t args)
   }
  
   // get kernel copy of filepath
-  //size_t useless;
-  
-  for (int i = 0; i < argcount; ++i)
-  {
-    kprintf("arg: %d\n", strlen(argv[i]));
-  }
-
   size_t useless;
   errcode = copyinstr((const_userptr_t)program, filepath, strlen(program) + 1, &useless);
-
-  for (int i = 0; i < argcount; ++i)
-  {
-    kprintf("arg: %d\n", strlen(argv[i]));
-  }
-
-  // moving this part of the code (getting filepath) to the top did not make the problem go away, instead it gave me a malloc error trying to allocate argv
-
   if (errcode)
   {
     freeArgv(argv, argcount - 1);