tyfuzz: instead of writing to /dev/null, just do not write

This commit is contained in:
Boris Faure 2019-12-04 21:44:37 +01:00
parent 99d8436f5a
commit 6bfd508a58
Signed by: borisfaure
GPG Key ID: EAA9CD729F522998
3 changed files with 1 additions and 11 deletions

View File

@ -1256,7 +1256,7 @@ termpty_write(Termpty *ty, const char *input, int len)
#else
int fd = ty->fd;
#if defined(ENABLE_FUZZING)
fd = ty->fd_dev_null;
return;
#endif
if (fd < 0) return;
if (write(fd, input, len) < 0)

View File

@ -170,9 +170,6 @@ struct _Termpty
int fd, slavefd;
#if defined(ENABLE_TESTS)
struct ty_sb write_buffer;
#endif
#if defined(ENABLE_FUZZING)
int fd_dev_null;
#endif
struct {
int curid;

View File

@ -263,10 +263,6 @@ _termpty_init(Termpty *ty, Config *config)
assert(ty->screen2);
ty->circular_offset = 0;
ty->fd = STDIN_FILENO;
#if defined(ENABLE_FUZZING)
ty->fd_dev_null = open("/dev/null", O_WRONLY|O_APPEND);
assert(ty->fd_dev_null >= 0);
#endif
ty->hl.bitmap = calloc(1, HL_LINKS_MAX / 8); /* bit map for 1 << 16 elements */
assert(ty->hl.bitmap);
/* Mark id 0 as set */
@ -281,9 +277,6 @@ _termpty_shutdown(Termpty *ty)
#if defined(ENABLE_TESTS)
ty_sb_free(&ty->write_buffer);
#endif
#if defined(ENABLE_FUZZING)
close(ty->fd_dev_null);
#endif
}
int