summaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2022-08-10 06:37:21 -0400
committerRobert Morris <[email protected]>2022-08-10 06:37:21 -0400
commit76ad8e974fefb4588b0a318f6502fde6bd730097 (patch)
treebbc87d501012eec75873a4849182ac9615a669cc /user
parent872fa88e8afd24a8f228ba431fad380d326b0f36 (diff)
downloadxv6-labs-76ad8e974fefb4588b0a318f6502fde6bd730097.tar.gz
xv6-labs-76ad8e974fefb4588b0a318f6502fde6bd730097.tar.bz2
xv6-labs-76ad8e974fefb4588b0a318f6502fde6bd730097.zip
avoid user-level segfault if a process doesn't call exit()
Diffstat (limited to 'user')
-rw-r--r--user/ulib.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/user/ulib.c b/user/ulib.c
index 4775939..c7b66c4 100644
--- a/user/ulib.c
+++ b/user/ulib.c
@@ -3,6 +3,17 @@
#include "kernel/fcntl.h"
#include "user/user.h"
+//
+// wrapper so that it's OK if main() does not call exit().
+//
+void
+_main()
+{
+ extern int main();
+ main();
+ exit(0);
+}
+
char*
strcpy(char *s, const char *t)
{