libsodium: Needed for Dnscrypto-proxy Release 1.3.0
[tomato.git] / release / src / router / vsftpd / utility.c
blobbdbfcf08d8316bd857a5e12771096101ecd09ae7
1 /*
2 * Part of Very Secure FTPd
3 * Licence: GPL v2
4 * Author: Chris Evans
5 * utility.c
6 */
8 #include "utility.h"
9 #include "sysutil.h"
10 #include "str.h"
11 #include "defs.h"
13 #define DIE_DEBUG
15 void
16 die(const char* p_text)
18 #ifdef DIE_DEBUG
19 bug(p_text);
20 #endif
21 vsf_sysutil_exit(1);
24 void
25 die2(const char* p_text1, const char* p_text2)
27 struct mystr die_str = INIT_MYSTR;
28 str_alloc_text(&die_str, p_text1);
29 str_append_text(&die_str, p_text2);
30 die(str_getbuf(&die_str));
33 void
34 bug(const char* p_text)
36 /* Rats. Try and write the reason to the network for diagnostics */
37 vsf_sysutil_activate_noblock(VSFTP_COMMAND_FD);
38 (void) vsf_sysutil_write_loop(VSFTP_COMMAND_FD, "500 OOPS: ", 10);
39 (void) vsf_sysutil_write_loop(VSFTP_COMMAND_FD, p_text,
40 vsf_sysutil_strlen(p_text));
41 (void) vsf_sysutil_write_loop(VSFTP_COMMAND_FD, "\r\n", 2);
42 vsf_sysutil_exit(1);
45 void
46 vsf_exit(const char* p_text)
48 (void) vsf_sysutil_write_loop(VSFTP_COMMAND_FD, p_text,
49 vsf_sysutil_strlen(p_text));
50 vsf_sysutil_exit(0);