summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2019-12-04 21:44:37 +0100
committerBoris Faure <billiob@gmail.com>2019-12-04 21:44:37 +0100
commit6bfd508a5887273b5b68a4d1bb973ed1bf4201e2 (patch)
tree38a9bc11004541bb9e2a70c6fdda7ced8e64b128
parent99d8436f5a3bbdddbfeaba59408874d84f04dfb3 (diff)
tyfuzz: instead of writing to /dev/null, just do not write
-rw-r--r--src/bin/termpty.c2
-rw-r--r--src/bin/termpty.h3
-rw-r--r--src/bin/tyfuzz.c7
3 files changed, 1 insertions, 11 deletions
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 61f78cb..ccc05c5 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -1256,7 +1256,7 @@ termpty_write(Termpty *ty, const char *input, int len)
1256#else 1256#else
1257 int fd = ty->fd; 1257 int fd = ty->fd;
1258#if defined(ENABLE_FUZZING) 1258#if defined(ENABLE_FUZZING)
1259 fd = ty->fd_dev_null; 1259 return;
1260#endif 1260#endif
1261 if (fd < 0) return; 1261 if (fd < 0) return;
1262 if (write(fd, input, len) < 0) 1262 if (write(fd, input, len) < 0)
diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index ca1605c..b892051 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -171,9 +171,6 @@ struct _Termpty
171#if defined(ENABLE_TESTS) 171#if defined(ENABLE_TESTS)
172 struct ty_sb write_buffer; 172 struct ty_sb write_buffer;
173#endif 173#endif
174#if defined(ENABLE_FUZZING)
175 int fd_dev_null;
176#endif
177 struct { 174 struct {
178 int curid; 175 int curid;
179 Eina_Hash *blocks; 176 Eina_Hash *blocks;
diff --git a/src/bin/tyfuzz.c b/src/bin/tyfuzz.c
index 0b4f00b..8272b4a 100644
--- a/src/bin/tyfuzz.c
+++ b/src/bin/tyfuzz.c
@@ -263,10 +263,6 @@ _termpty_init(Termpty *ty, Config *config)
263 assert(ty->screen2); 263 assert(ty->screen2);
264 ty->circular_offset = 0; 264 ty->circular_offset = 0;
265 ty->fd = STDIN_FILENO; 265 ty->fd = STDIN_FILENO;
266#if defined(ENABLE_FUZZING)
267 ty->fd_dev_null = open("/dev/null", O_WRONLY|O_APPEND);
268 assert(ty->fd_dev_null >= 0);
269#endif
270 ty->hl.bitmap = calloc(1, HL_LINKS_MAX / 8); /* bit map for 1 << 16 elements */ 266 ty->hl.bitmap = calloc(1, HL_LINKS_MAX / 8); /* bit map for 1 << 16 elements */
271 assert(ty->hl.bitmap); 267 assert(ty->hl.bitmap);
272 /* Mark id 0 as set */ 268 /* Mark id 0 as set */
@@ -281,9 +277,6 @@ _termpty_shutdown(Termpty *ty)
281#if defined(ENABLE_TESTS) 277#if defined(ENABLE_TESTS)
282 ty_sb_free(&ty->write_buffer); 278 ty_sb_free(&ty->write_buffer);
283#endif 279#endif
284#if defined(ENABLE_FUZZING)
285 close(ty->fd_dev_null);
286#endif
287} 280}
288 281
289int 282int