From eda842cbb639c80731ea23b6436ae958ada39848 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Tue, 17 Sep 2019 12:28:42 +0200 Subject: cleanup --- src/misc.c | 4 +++- src/misc.h | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/misc.c b/src/misc.c index c2803a6..0bf7233 100644 --- a/src/misc.c +++ b/src/misc.c @@ -47,8 +47,10 @@ int try_write(int _fd, char *_buff, int _size, int _retry) if(ret < 0) return 1; - else + else { written += ret; + cntr = 0; //reset fail counter + } if(++cntr > _retry) return 1; diff --git a/src/misc.h b/src/misc.h index 49a3384..21b2d75 100644 --- a/src/misc.h +++ b/src/misc.h @@ -13,6 +13,12 @@ #include #include +/* + * Try writing to _fd for _retry times. Retries are reset after every succesful write. + */ int try_write(int _fd, char *_buff, int _size, int _retry); +/* + * Fork, exec(argc, argv) with new STDIO, return PID + */ pid_t fork_run(int _stdin, int _stdout, int _stderr, int argc, char* argv[]); -- cgit v1.2.3