summaryrefslogtreecommitdiff
path: root/src/libc
diff options
context:
space:
mode:
authordzwdz2023-08-29 23:02:42 +0200
committerdzwdz2023-08-29 23:02:42 +0200
commitdd385a413c92d53a1f792011e1029d7d68e19c6c (patch)
tree134fa61d71f6894e37a1b890004cfcb2d96ea17b /src/libc
parente43939bcc6123e02314aa403eef94d5ace441f7f (diff)
tests: fix everything broken by the pipe change
god, those tests are a mess. so are esemaphores.
Diffstat (limited to 'src/libc')
-rw-r--r--src/libc/esemaphore.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libc/esemaphore.c b/src/libc/esemaphore.c
index 2707d11..8e1d7b8 100644
--- a/src/libc/esemaphore.c
+++ b/src/libc/esemaphore.c
@@ -5,7 +5,7 @@
#include <esemaphore.h>
void esem_signal(struct evil_sem *sem) {
- _sys_write(sem->signal, NULL, 0, 0, 0);
+ _sys_write(sem->signal, "", 1, 0, 0);
}
void esem_wait(struct evil_sem *sem) {
@@ -15,6 +15,7 @@ void esem_wait(struct evil_sem *sem) {
struct evil_sem *esem_new(int value) {
hid_t ends_wait[2], ends_signal[2];
struct evil_sem *sem;
+ char dummy;
if (value < 0) return NULL;
if (_sys_pipe(ends_wait, 0) < 0) return NULL;
@@ -23,9 +24,9 @@ struct evil_sem *esem_new(int value) {
if (!_sys_fork(FORK_NOREAP, NULL)) {
close(ends_signal[1]);
- while (_sys_read(ends_signal[0], NULL, 0, 0) >= 0) {
+ while (_sys_read(ends_signal[0], &dummy, 1, 0) > 0) {
if (!_sys_fork(FORK_NOREAP, NULL)) {
- _sys_write(ends_wait[1], NULL, 0, 0, 0);
+ _sys_write(ends_wait[1], "", 1, 0, 0);
exit(0);
}
}