summaryrefslogtreecommitdiff
path: root/dtach.h
diff options
context:
space:
mode:
authorNed T. Crigler <crigler@gmail.com>2025-06-19 19:45:22 -0700
committerNed T. Crigler <crigler@gmail.com>2025-06-19 20:30:18 -0700
commitdc84bf8b0f70af92f894209d2cf68eaff55db9f0 (patch)
tree4805f9238336fa21f396beb14fd278a4feac9911 /dtach.h
parent6e04acf9ed089f065b19ff4e42be97bd17529ff2 (diff)
Always check the return value of the write() system call
dtach was assuming that writes with a small byte count could never fail, and was not handling partial writes for larger byte counts in a few places. This should also suppress unused result warnings from gcc on systems that define _FORTIFY_SOURCE by default.
Diffstat (limited to 'dtach.h')
-rw-r--r--dtach.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/dtach.h b/dtach.h
index 56867c8..fd6b59c 100644
--- a/dtach.h
+++ b/dtach.h
@@ -139,6 +139,9 @@ struct packet
/* This hopefully moves to the bottom of the screen */
#define EOS "\033[999H"
+void write_buf_or_fail(int fd, const void *buf, size_t count);
+void write_packet_or_fail(int fd, const struct packet *pkt);
+
int attach_main(int noerror);
int master_main(char **argv, int waitattach, int dontfork);
int push_main(void);