Removed all instances of crash_prog()
crash_prog was introduced to force-crash a userspace program since _exit may not yet be implemented. However, the new versions of OS161 already have the exact same logic as crash_prog in stdlib/exit.
This commit is contained in:
@@ -60,7 +60,6 @@ doopen(const char *path, int openflags)
|
||||
fd = open(path, openflags, 0664);
|
||||
if (fd < 0) {
|
||||
err(1, "%s", path);
|
||||
crash_prog();
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
@@ -77,7 +76,6 @@ dodup2(int ofd, int nfd, const char *file)
|
||||
}
|
||||
if (r != nfd) {
|
||||
errx(1, "%s: dup2: Expected %d, got %d", nfd, r);
|
||||
crash_prog();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,12 +100,10 @@ mkfile(void)
|
||||
r = write(fd, slogan, strlen(slogan));
|
||||
if (r < 0) {
|
||||
err(1, "%s: write", INFILE);
|
||||
crash_prog();
|
||||
}
|
||||
if ((size_t)r != strlen(slogan)) {
|
||||
errx(1, "%s: write: Short count (got %zd, expected %zu)",
|
||||
INFILE, r, strlen(slogan));
|
||||
crash_prog();
|
||||
}
|
||||
|
||||
doclose(fd, INFILE);
|
||||
@@ -126,16 +122,13 @@ chkfile(void)
|
||||
r = read(fd, buf, sizeof(buf));
|
||||
if (r < 0) {
|
||||
err(1, "%s: read", OUTFILE);
|
||||
crash_prog();
|
||||
}
|
||||
if (r == 0) {
|
||||
errx(1, "%s: read: Unexpected EOF", OUTFILE);
|
||||
crash_prog();
|
||||
}
|
||||
if ((size_t)r != strlen(slogan)) {
|
||||
errx(1, "%s: read: Short count (got %zd, expected %zu)",
|
||||
OUTFILE, r, strlen(slogan));
|
||||
crash_prog();
|
||||
}
|
||||
|
||||
doclose(fd, OUTFILE);
|
||||
@@ -155,7 +148,6 @@ cat(void)
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
err(1, "fork");
|
||||
crash_prog();
|
||||
}
|
||||
|
||||
if (pid == 0) {
|
||||
@@ -178,15 +170,12 @@ cat(void)
|
||||
result = waitpid(pid, &status, 0);
|
||||
if (result == -1) {
|
||||
err(1, "waitpid");
|
||||
crash_prog();
|
||||
}
|
||||
if (WIFSIGNALED(status)) {
|
||||
errx(1, "pid %d: Signal %d", (int)pid, WTERMSIG(status));
|
||||
crash_prog();
|
||||
}
|
||||
if (WIFEXITED(status) && WEXITSTATUS(status) != 0) {
|
||||
errx(1, "pid %d: Exit %d", (int)pid, WEXITSTATUS(status));
|
||||
crash_prog();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user