etc~ scripts and random things |
| git clone https://github.com/djnnvx/etc.git |
| log | files | refs | archive |
mock_pty_stubs.c (1414B)
1 /* Stub implementations of PTY functions used by ttyd's protocol.c. 2 * All functions are no-ops so no real processes are ever launched during 3 * fuzzing. Signatures match pty.h exactly. */ 4 5 #include "fuzz-include/libwebsockets.h" 6 #include "fuzz-include/uv.h" 7 #include "ttyd-src/src/server.h" 8 #include "ttyd-src/src/pty.h" 9 #include <stdlib.h> 10 #include <string.h> 11 12 pty_buf_t *pty_buf_init(char *base, size_t len) { return NULL; } 13 void pty_buf_free(pty_buf_t *buf) {} 14 pty_process *process_init(void *ctx, uv_loop_t *loop, 15 char *argv[], char *envp[]) { pty_process *p = calloc(1, sizeof(pty_process)); if (p) p->ctx = ctx; return p; } 16 bool process_running(pty_process *process) { return false; } 17 void process_free(pty_process *process) { free(process); } 18 int pty_spawn(pty_process *process, 19 pty_read_cb read_cb, 20 pty_exit_cb exit_cb) { return 0; } 21 void pty_pause(pty_process *process) {} 22 void pty_resume(pty_process *process) {} 23 int pty_write(pty_process *process, 24 pty_buf_t *buf) { return -1; } 25 bool pty_resize(pty_process *process) { return false; } 26 bool pty_kill(pty_process *process, int sig) { return false; }