aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmail-remote/qmailr_error.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2026-02-06 02:16:08 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2026-02-06 02:16:08 +0000
commit5ca4a0e5b65066f41af7c670e8200b0d0eba41dd (patch)
tree76f0fdef194f6227f4903d9139157a76b18f936e /src/qmail-remote/qmailr_error.c
parent025de935255c05d72a5c35d86c6c5c4d212247a1 (diff)
downloadsmtpd-starttls-proxy-5ca4a0e5b65066f41af7c670e8200b0d0eba41dd.tar.gz
Just name it qmail-remote after all
Diffstat (limited to 'src/qmail-remote/qmailr_error.c')
-rw-r--r--src/qmail-remote/qmailr_error.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/qmail-remote/qmailr_error.c b/src/qmail-remote/qmailr_error.c
new file mode 100644
index 0000000..fcdce54
--- /dev/null
+++ b/src/qmail-remote/qmailr_error.c
@@ -0,0 +1,38 @@
+/* ISC license. */
+
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <skalibs/buffer.h>
+
+#include <smtpd-starttls-proxy/config.h>
+
+void qmailr_diev (int permanent, char const *const *v, unsigned int n)
+{
+ buffer_put(buffer_1small, permanent ? "D" : "Z", 1) ;
+ while (n--) buffer_puts(buffer_1small, *v++) ;
+ buffer_putflush(buffer_1small, "\n", 2) ;
+ _exit(0) ;
+}
+
+void qmailr_dievsys (char const *const *v, unsigned int n)
+{
+ char const *se = strerror(errno) ;
+ buffer_put(buffer_1small, "Z", 1) ;
+ while (n--) buffer_puts(buffer_1small, *v++) ;
+ buffer_put(buffer_1small, ": ", 2) ;
+ buffer_puts(buffer_1small, se) ;
+ buffer_putflush(buffer_1small, "\n", 2) ;
+ _exit(0) ;
+}
+
+void qmailr_die (int permanent, char const *msg)
+{
+ qmailr_diev(permanent, &msg, 1) ;
+}
+
+void qmailr_diesys (char const *msg)
+{
+ qmailr_dievsys(&msg, 1) ;
+}