Przeglądaj źródła

Merge branch 'a2b' of tarfeef101/cs350 into master

Tareef Dedhar 6 lat temu
rodzic
commit
9b4c9e283d

+ 5 - 2
buildscript.sh

@@ -1,10 +1,13 @@
 #!/bin/bash
 set -eu
-topdir=$(pwd)
+topdir=`pwd`
+buildir='~/cs350-os161/os161-1.99'
+eval cd $buildir
 cd ./kern/compile/ASST$1
 bmake depend
 bmake
 bmake install
-cd $topdir
+eval cd $buildir
 bmake
 bmake install
+cd $topdir

+ 4 - 2
fastscript.sh

@@ -1,9 +1,11 @@
 #!/bin/bash
 set -eu
-topdir=$(pwd)
-cd ./kern/compile/ASST$1
+topdir=`pwd`
+buildir='~/cs350-os161/os161-1.99'
+eval cd $buildir/kern/compile/ASST$1
 bmake depend
 bmake
 bmake install
 echo "SUCCESS!!!!!!!!!!"
 echo ""
+cd $topdir

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 = 248;
+const int buildversion = 249;
 const char buildconfig[] = "ASST2";

+ 1 - 1
kern/compile/ASST2/version

@@ -1 +1 @@
-248
+249

+ 6 - 0
kern/syscall/proc_syscalls.c

@@ -221,6 +221,11 @@ int sys_execv(const char * program, userptr_t args)
   for (int i = 0; i < argcount; ++i)
   {
     char * useraddr = kmalloc(sizeof(temp));
+    if (!(useraddr))
+    {
+      kfree(argv);
+      return ENOMEM;
+    }
     // useraddr is now the address of the string in userland
     errcode = copyin(temp, useraddr, sizeof(temp));
     if (errcode)
@@ -230,6 +235,7 @@ int sys_execv(const char * program, userptr_t args)
     }
     // change argv[i] to be a string of length enough
     int strLen = strlen(*(char **)useraddr) + 1;
+    kfree(useraddr);
     size_t wasteOfSpace;
     argv[i] = kmalloc(strLen * sizeof(char));
     if (!(argv[i]))