diff --git a/tests/args.c b/tests/args.c
index 49e7ae0ff4d127792f3ddfe7903480cea5eb4dcf..c868d78d2ea587058bae3a3b83fbdadd41b846f7 100644
--- a/tests/args.c
+++ b/tests/args.c
@@ -2,8 +2,7 @@
 #include <unistd.h>
 
 int main(int argc, char *argv[]) {
-    int i;
-    for(i = 0; i < argc; i++) {
+    for(int i = 0; i < argc; i++) {
         write(STDOUT_FILENO, argv[i], strlen(argv[i]));
         write(STDOUT_FILENO, " ", 1);
     }
diff --git a/tests/resource/getrusage.c b/tests/resource/getrusage.c
index f924b5ae3455ea6aee19689ddb7f4fc55b565d1c..e2384c8d5c9bbe1a055dd95b18e1f5265023cc37 100644
--- a/tests/resource/getrusage.c
+++ b/tests/resource/getrusage.c
@@ -1,5 +1,6 @@
 #include <errno.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/resource.h>
 
 void ptimeval(struct timeval* val) {
@@ -8,14 +9,18 @@ void ptimeval(struct timeval* val) {
 
 int main(void) {
     struct rusage r_usage;
-    if (getrusage(RUSAGE_SELF, &r_usage) < 0) {
+
+    if (getrusage(RUSAGE_SELF, &r_usage) == -1) {
         perror("getrusage");
         exit(EXIT_FAILURE);
     }
+
     printf("ru_utime:");
     ptimeval(&r_usage.ru_utime);
+
     printf("ru_stime:");
     ptimeval(&r_usage.ru_utime);
+
     printf("ru_maxrss: %ld\n", r_usage.ru_maxrss);
     printf("ru_ixrss: %ld\n", r_usage.ru_ixrss);
     printf("ru_idrss: %ld\n", r_usage.ru_idrss);
diff --git a/tests/unistd/brk.c b/tests/unistd/brk.c
index 811644e28d18e6ef491b1967025670058138ea11..d480006a946c1fa0e5fe1d17d51e77ac4e17e4ff 100644
--- a/tests/unistd/brk.c
+++ b/tests/unistd/brk.c
@@ -1,7 +1,15 @@
 #include <unistd.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 int main(void) {
     int status = brk((void*)100);
-    printf("brk exited with status code %d\n", status);
+
+    if (status == -1) {
+        perror("brk");
+        exit(EXIT_FAILURE);
+    } else if (status != 0) {
+        printf("brk returned %d, unexpected result\n", status);
+        exit(EXIT_FAILURE);
+    }
 }
diff --git a/tests/unistd/chdir.c b/tests/unistd/chdir.c
index 28178922e8005833ccd8550566abcfb351c72613..eb341b1bb2e75d1cafa645af6768e6ad21772577 100644
--- a/tests/unistd/chdir.c
+++ b/tests/unistd/chdir.c
@@ -1,15 +1,40 @@
+#include <limits.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
 
 int main(void) {
-    char* cwd1 = malloc(4096*sizeof(char));//(char*) calloc(4096 + 1, sizeof(char));
-    getcwd(cwd1, 4096);
-    printf("initial cwd: %s\n", cwd1);
-    free(cwd1);
-    chdir("..");
-    char* cwd2 = malloc(4096*sizeof(char));//(char*) calloc(4096 + 1, sizeof(char));
-    getcwd(cwd2, 4096);
-    printf("final cwd: %s\n", cwd2);
-    free(cwd2);
+    char cwd[PATH_MAX] = { 0 };
+    char *cwd_result = NULL;
+
+    cwd_result = getcwd(cwd, PATH_MAX);
+    if (cwd_result == NULL) {
+        perror("getcwd");
+        exit(EXIT_FAILURE);
+    } else if (cwd_result != cwd) {
+        puts("getcwd returned something else than the buf argument");
+        exit(EXIT_FAILURE);
+    }
+
+    printf("getcwd before chdir: %s\n", cwd);
+
+    int status = chdir("..");
+    if (status == -1) {
+        perror("chdir");
+        exit(EXIT_FAILURE);
+    } else if (status != 0) {
+        printf("chdir returned %d, unexpected result\n", status);
+        exit(EXIT_FAILURE);
+    }
+
+    cwd_result = getcwd(cwd, PATH_MAX);
+    if (cwd_result == NULL) {
+        perror("getcwd");
+        exit(EXIT_FAILURE);
+    } else if (cwd_result != cwd) {
+        puts("getcwd returned something else than the buf argument");
+        exit(EXIT_FAILURE);
+    }
+
+    printf("getcwd after chdir: %s\n", cwd);
 }
diff --git a/tests/unistd/exec.c b/tests/unistd/exec.c
index 43b10ddccb31bc82ed5f3271b844c1f94c265346..cc7bfe50ef4a30e98861fa79064455dff03e2a34 100644
--- a/tests/unistd/exec.c
+++ b/tests/unistd/exec.c
@@ -1,8 +1,13 @@
 #include <unistd.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 int main(void) {
     char* args[] = {"sh", "-c", "echo 'exec works :D'", NULL};
-    execv("/bin/sh", args);
-    perror("execv");
+
+    int status = execv("/bin/sh", args);
+    if (status == -1) {
+        perror("execv");
+        exit(EXIT_FAILURE);
+    }
 }
diff --git a/tests/unistd/fchdir.c b/tests/unistd/fchdir.c
index 9e3ab29b7e6f4ffb5feeb7cd6c697e3087d67c68..b04bcdf565b6693455714893a4f52d5e0523d458 100644
--- a/tests/unistd/fchdir.c
+++ b/tests/unistd/fchdir.c
@@ -1,11 +1,33 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 int main(void) {
     int fd = open("..", 0, 0);
-    int status;
-    status = fchdir(fd);
-    printf("fchdir exited with status code %d\n", status);
-    close(fd);
+    if (fd == -1) {
+        perror("open");
+        exit(EXIT_FAILURE);
+    } else if (fd < 0) {
+        printf("open returned %d, unexpected result\n", fd);
+        exit(EXIT_FAILURE);
+    }
+
+    int status = fchdir(fd);
+    if (status == -1) {
+        perror("fchdir");
+        exit(EXIT_FAILURE);
+    } else if (status != 0) {
+        printf("fchdir returned %d, unexpected result\n", status);
+        exit(EXIT_FAILURE);
+    }
+
+    int c = close(fd);
+    if (c == -1) {
+        perror("close");
+        exit(EXIT_FAILURE);
+    } else if (c != 0) {
+        printf("close returned %d, unexpected result\n", c);
+        exit(EXIT_FAILURE);
+    }
 }
diff --git a/tests/unistd/fsync.c b/tests/unistd/fsync.c
index 7f337f1caa0e4c2826df091b8c81e574921b8c21..47b894e3ebd810ba5b58fce970b1c3decbf01b6e 100644
--- a/tests/unistd/fsync.c
+++ b/tests/unistd/fsync.c
@@ -1,11 +1,33 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 int main(void) {
     int fd = open(".", 0, 0);
-    int status;
-    status = fsync(fd);
-    printf("fsync exited with status code %d\n", status);
-    close(fd);
+    if (fd == -1) {
+        perror("open");
+        exit(EXIT_FAILURE);
+    } else if (fd < 0) {
+        printf("open returned %d, unexpected result\n", fd);
+        exit(EXIT_FAILURE);
+    }
+
+    int status = fsync(fd);
+    if (status == -1) {
+        perror("fsync");
+        exit(EXIT_FAILURE);
+    } else if (status != 0) {
+        printf("fsync returned %d, unexpected result\n", status);
+        exit(EXIT_FAILURE);
+    }
+
+    int c = close(fd);
+    if (c == -1) {
+        perror("close");
+        exit(EXIT_FAILURE);
+    } else if (c != 0) {
+        printf("close returned %d, unexpected result\n", c);
+        exit(EXIT_FAILURE);
+    }
 }
diff --git a/tests/unistd/ftruncate.c b/tests/unistd/ftruncate.c
index 7eb4f9822d02fe7f2c414b1863bf2cc3761c5f3a..b71f833e4c6c8272c05a002580ae22d6704234f3 100644
--- a/tests/unistd/ftruncate.c
+++ b/tests/unistd/ftruncate.c
@@ -1,11 +1,33 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 int main(void) {
     int fd = creat("ftruncate.out", 0777);
-    int status;
-    status = ftruncate(fd, 100);
-    printf("ftruncate exited with status code %d\n", status);
-    close(fd);
+    if (fd == -1) {
+        perror("creat");
+        exit(EXIT_FAILURE);
+    } else if (fd < 0) {
+        printf("creat returned %d, unexpected result\n", fd);
+        exit(EXIT_FAILURE);
+    }
+
+    int status = ftruncate(fd, 100);
+    if (status == -1) {
+        perror("ftruncate");
+        exit(EXIT_FAILURE);
+    } else if (status != 0) {
+        printf("ftruncate returned %d, unexpected result\n", status);
+        exit(EXIT_FAILURE);
+    }
+
+    int c = close(fd);
+    if (c == -1) {
+        perror("close");
+        exit(EXIT_FAILURE);
+    } else if (c != 0) {
+        printf("close returned %d, unexpected result\n", c);
+        exit(EXIT_FAILURE);
+    }
 }
diff --git a/tests/unistd/getcwd.c b/tests/unistd/getcwd.c
index 2f9442e2a4f93d80757879f7c5442c7ce9490706..22074dd7092f6e69f47c2c2c294c36d33b63d694 100644
--- a/tests/unistd/getcwd.c
+++ b/tests/unistd/getcwd.c
@@ -5,7 +5,7 @@
 #include <unistd.h>
 
 int main(void) {
-    char first[PATH_MAX];
+    char first[PATH_MAX] = { 0 };
     getcwd(first, PATH_MAX);
     puts(first);
 
diff --git a/tests/unistd/gethostname.c b/tests/unistd/gethostname.c
index 85119c32f53572f5af1a11c98a7abb2b1283f40a..889108be31e10d82a407b3fcfbc3fd7e2eee4802 100644
--- a/tests/unistd/gethostname.c
+++ b/tests/unistd/gethostname.c
@@ -3,10 +3,16 @@
 #include <unistd.h>
 
 int main(void) {
-    char* hostname = malloc(256);
-    if (gethostname(hostname, 256) == 0) {
+    char hostname[256] = { 0 };
+
+    int status = gethostname(hostname, 256);
+    if (status == 0) {
         printf("Hostname: %s\n", hostname);
+    } else if (status == -1) {
+        perror("gethostname");
+        exit(EXIT_FAILURE);
     } else {
-        puts("error getting hostname");
+        printf("gethostname returned %d, unexpected result\n", status);
+        exit(EXIT_FAILURE);
     }
 }
diff --git a/tests/unistd/isatty.c b/tests/unistd/isatty.c
index 33855fbaf9bf7ca99723884cd4a471b4d57f6ddd..25248c5fff3486495d2c44e34339eb91e3daaf80 100644
--- a/tests/unistd/isatty.c
+++ b/tests/unistd/isatty.c
@@ -1,11 +1,24 @@
+#include <errno.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 
 int main(void) {
-    // 1 is stdout
-    if (isatty(1)) {
+    int status = isatty(STDOUT_FILENO);
+
+    if (status == 1) {
         puts("'Tis a tty :D");
+    } else if (status == 0) {
+        if (errno == ENOTTY) {
+            // I wouldn't consider stdout not being a TTY an error
+            // (CI runners, etc.) 
+            puts("Whatever a tty is, it's not me");
+        } else {
+            perror("isatty");
+            exit(EXIT_FAILURE);
+        }
     } else {
-        puts("Whatever a tty is, it's not me");
+        printf("isatty returned %d, unexpected result\n", status);
+        exit(EXIT_FAILURE);
     }
 }