Check system() return value

This commit is contained in:
Anthony Wang 2022-12-28 16:00:57 -06:00
parent cd9b330a1f
commit b1b2e1c521
Signed by: a
GPG key ID: 42A5B952E6DD8D38

9
sd.c
View file

@ -1,6 +1,7 @@
#include <assert.h>
#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
@ -56,8 +57,8 @@ int main(int argc, char* argv[]) {
} }
/* Disable input buffering */ /* Disable input buffering */
system("stty -F /dev/tty cbreak min 1"); assert(system("stty -F /dev/tty cbreak min 1") == 0);
system("stty -F /dev/tty -echo"); assert(system("stty -F /dev/tty -echo") == 0);
while (true) { while (true) {
int x = (long long)rand() * rand() % seg[1]; int x = (long long)rand() * rand() % seg[1];
@ -100,6 +101,6 @@ int main(int argc, char* argv[]) {
} }
/* Cleanup */ /* Cleanup */
system("stty -F /dev/tty echo");
sqlite3_close(db); sqlite3_close(db);
assert(system("stty -F /dev/tty echo") == 0);
} }