diff options
author | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2008-07-18 07:15:27 +0000 |
---|---|---|
committer | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2008-07-18 07:15:27 +0000 |
commit | 6cd276ba3fced973e5006ccabcb51d5734721914 (patch) | |
tree | 4e0c3b9f0d2020e983387107457b3731b4650cad /init.c | |
parent | gen_path will no longer silently truncate the generated (diff) | |
download | openvpn-6cd276ba3fced973e5006ccabcb51d5734721914.tar.xz |
status_printf function will now set error flag on
output truncation or failure of write() to write the
expected number of bytes.
Raised STATUS_PRINTF_MAXLEN to 512 (from 256).
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@3077 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to '')
-rw-r--r-- | init.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -439,7 +439,7 @@ init_static (void) return false; #endif -#if 0 +#ifdef GEN_PATH_TEST { struct gc_arena gc = gc_new (); const char *fn = gen_path ("foo", @@ -448,7 +448,20 @@ init_static (void) printf ("%s\n", fn); gc_free (&gc); } + return false; +#endif +#ifdef STATUS_PRINTF_TEST + { + struct gc_arena gc = gc_new (); + const char *tmp_file = create_temp_filename ("/tmp", "foo", &gc); + struct status_output *so = status_open (tmp_file, 0, -1, NULL, STATUS_OUTPUT_WRITE); + status_printf (so, "%s", "foo"); + status_printf (so, "%s", "bar"); + if (!status_close (so)) + msg (M_WARN, "STATUS_PRINTF_TEST: %s: write error", tmp_file); + gc_free (&gc); + } return false; #endif |