fix bug on invalid fd

This commit is contained in:
Khaïs COLIN 2024-11-01 17:04:37 +01:00
parent b5a957f5a4
commit 25d6ee0ae9
3 changed files with 30 additions and 18 deletions

View file

@ -1,9 +1,12 @@
#!/usr/bin/env bash
set -xuo pipefail
set -euo pipefail
for FAIL_AFTER in `seq 1 1000`
do
cc -ggdb -Wall -Wextra -Werror -D FAIL_AFTER=$FAIL_AFTER *.c
valgrind -q --leak-check=full ./a.out get_next_line.c
cc -ggdb -Wall -Wextra -Werror -D FAIL_AFTER=$FAIL_AFTER -D BUFFER_SIZE=$2 *.c
echo
echo "num failed malloc: $FAIL_AFTER"
echo
valgrind -q --leak-check=full --error-exitcode=1 ./a.out $1
done