aboutsummaryrefslogtreecommitdiffstats
path: root/XUtils.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2023-02-05 04:25:56 +0100
committerDaniel Lange <DLange@git.local>2023-02-05 04:25:56 +0100
commitf288666edc9180a2e81e6655951878124f321df6 (patch)
treeda70bf44b2423f6f8e9a070c063fed79d190b489 /XUtils.c
parent937052b231259a47d881d539ad5748245ef55b99 (diff)
downloaddebian_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.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/XUtils.c b/XUtils.c
index 2012b6c..6a021f3 100644
--- a/XUtils.c
+++ b/XUtils.c
@@ -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;
+}

© 2014-2024 Faster IT GmbH | imprint | privacy policy