1
0
Fork 0

fix segfault when invoked with -h

This commit is contained in:
dtb 2024-01-15 13:39:56 -07:00
parent c1e9ba2031
commit ac22069e2b
1 changed files with 4 additions and 0 deletions

View File

@ -7,6 +7,7 @@
#if !defined EX_OK || !defined EX_USAGE
# include <sysexits.h>
#endif
extern int errno;
struct Io_ex{
size_t s;
@ -49,6 +50,9 @@ static struct Io *
Io_destruct(struct Io *io){
size_t i;
if(io->s == -1)
io->s = 0;
for(i = 0; i < io->s; ++i)
fclose(io->files[i]);