diff options
author | Daniel Lange <DLange@git.local> | 2023-02-05 04:25:56 +0100 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2023-02-05 04:25:56 +0100 |
commit | f288666edc9180a2e81e6655951878124f321df6 (patch) | |
tree | da70bf44b2423f6f8e9a070c063fed79d190b489 /XUtils.c | |
parent | 937052b231259a47d881d539ad5748245ef55b99 (diff) | |
download | debian_htop-f288666edc9180a2e81e6655951878124f321df6.tar.gz debian_htop-f288666edc9180a2e81e6655951878124f321df6.tar.bz2 debian_htop-f288666edc9180a2e81e6655951878124f321df6.zip |
New upstream version 3.2.2upstream/3.2.2
Diffstat (limited to 'XUtils.c')
-rw-r--r-- | XUtils.c | 31 |
1 files changed, 27 insertions, 4 deletions
@@ -21,7 +21,7 @@ in the source distribution for its full text. #include "CRT.h" -void fail() { +void fail(void) { CRT_done(); abort(); @@ -104,9 +104,9 @@ inline bool String_contains_i(const char* s1, const char* s2, bool multi) { String_freeArray(needles); return true; } - } - String_freeArray(needles); - return false; + } + String_freeArray(needles); + return false; } else { return strcasestr(s1, s2) != NULL; } @@ -313,3 +313,26 @@ ssize_t xReadfileat(openat_arg_t dirfd, const char* pathname, void* buffer, size return readfd_internal(fd, buffer, count); } + +ssize_t full_write(int fd, const void* buf, size_t count) { + ssize_t written = 0; + + while (count > 0) { + ssize_t r = write(fd, buf, count); + if (r < 0) { + if (errno == EINTR) + continue; + + return r; + } + + if (r == 0) + break; + + written += r; + buf = (const unsigned char*)buf + r; + count -= (size_t)r; + } + + return written; +} |