]> Devi Nivas Git - cs3210-lab1.git/commitdiff
fixes from Peter Froehlich
authorRuss Cox <rsc@swtch.com>
Mon, 28 Feb 2011 14:32:20 +0000 (09:32 -0500)
committerRuss Cox <rsc@swtch.com>
Mon, 28 Feb 2011 14:32:20 +0000 (09:32 -0500)
console.c
mkfs.c
syscall.c

index 634e9e86caa51c30f4273c457aeeebf586c2dd98..27649e68ed3e51a125cba50fbbad504200f7b364 100644 (file)
--- a/console.c
+++ b/console.c
@@ -23,24 +23,24 @@ static struct {
 } cons;
 
 static void
-printint(int xx, int base, int sgn)
+printint(int xx, int base, int sign)
 {
   static char digits[] = "0123456789abcdef";
   char buf[16];
-  int i, neg;
+  int i;
   uint x;
 
-  if(sgn && (neg = xx < 0)){
-    neg = 1;
+  if(sign && (sign = xx < 0))
     x = -xx;
-  else
+  else
     x = xx;
 
   i = 0;
   do{
     buf[i++] = digits[x % base];
   }while((x /= base) != 0);
-  if(neg)
+
+  if(sign)
     buf[i++] = '-';
 
   while(--i >= 0)
diff --git a/mkfs.c b/mkfs.c
index 77e6791dcfe3e829868210a91f4d2656b8ed9c55..20b9649f49a10b14b8502ef4fa90643a6a93dda8 100644 (file)
--- a/mkfs.c
+++ b/mkfs.c
@@ -229,7 +229,7 @@ balloc(int used)
   int i;
 
   printf("balloc: first %d blocks have been allocated\n", used);
-  assert(used < 512);
+  assert(used < 512*8);
   bzero(buf, 512);
   for(i = 0; i < used; i++){
     buf[i/8] = buf[i/8] | (0x1 << (i%8));
index 16c5b47dd7eabf01588e88e19c6a598d2e5266da..f6550a1654f2247df8ec03236688c265a23f6894 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -57,7 +57,7 @@ argptr(int n, char **pp, int size)
   
   if(argint(n, &i) < 0)
     return -1;
-  if((uint)i >= proc->sz || (uint)i+size >= proc->sz)
+  if((uint)i >= proc->sz || (uint)i+size > proc->sz)
     return -1;
   *pp = (char*)i;
   return 0;