From b6b956400c535e358a2125f5d2d66f17bb96f787 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Thu, 16 Dec 2021 21:11:17 +0100 Subject: [PATCH] TD3 Remove some compilation warnings --- code/userprog/exception.cc | 2 +- code/userprog/userthread.cc | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/code/userprog/exception.cc b/code/userprog/exception.cc index b6e0247..67dc603 100644 --- a/code/userprog/exception.cc +++ b/code/userprog/exception.cc @@ -231,7 +231,7 @@ ExceptionHandler (ExceptionType which) { int s = machine->ReadRegister(4); char * command = new char[MAX_STRING_SIZE]; - int size = copyStringFromMachine(s, command, MAX_STRING_SIZE); + copyStringFromMachine(s, command, MAX_STRING_SIZE); do_ForkExec(command); break; } diff --git a/code/userprog/userthread.cc b/code/userprog/userthread.cc index 2dc3b92..8de15db 100644 --- a/code/userprog/userthread.cc +++ b/code/userprog/userthread.cc @@ -92,9 +92,7 @@ void do_ThreadExit(){ currentThread->space = NULL; } - DEBUG('x', "Thread killed!\n"); currentThread->Finish(); - DEBUG('x', "Thread killed!\n"); } @@ -114,16 +112,15 @@ int do_ForkExec( const char * c){ file = fileSystem->Open(c); if (file == NULL) { - printf("Unable to open file %s\n", file); + printf("Unable to open file %s\n", c); return -1; } try { space = new AddrSpace(file); }catch(const std::bad_alloc& e) { - printf("==> BAD ALLOC ERROR: no empty space\n"); - delete space; - ASSERT(false); + fprintf(stderr,"no empty space on memory\n"); + Exit(1); } fork = new Thread("forkThread");