-/* $Cambridge: exim/src/src/debug.c,v 1.7 2009/11/16 19:50:36 nm4 Exp $ */
-
/*************************************************
* Exim - an Internet mail transport agent *
*************************************************/
-/* Copyright (c) University of Cambridge 1995 - 2009 */
+/* Copyright (c) University of Cambridge 1995 - 2015 */
/* See the file NOTICE for conditions of use and distribution. */
Arguments:
p tree node
- pos amount of indenting & vertical bars to pring
+ pos amount of indenting & vertical bars to print
barswitch if TRUE print | at the pos value
Returns: nothing
*/
void
-debug_print_argv(uschar **argv)
+debug_print_argv(const uschar ** argv)
{
debug_printf("exec");
while (*argv != NULL) debug_printf(" %.256s", *argv++);
tidier output when running parallel remote deliveries with debugging turned on.
Must do the whole thing with a single printf and flush, as otherwise output may
get interleaved. Since some calls to debug_printf() don't end with newline,
-we save up the text until we do get the newline. */
+we save up the text until we do get the newline.
+Take care to not disturb errno. */
void
debug_printf(const char *format, ...)
void
debug_vprintf(const char *format, va_list ap)
{
-if (debug_file == NULL) return;
+int save_errno = errno;
+
+if (!debug_file) return;
/* Various things can be inserted at the start of a line. Don't use the
tod_stamp() function for the timestamp, because that will overwrite the
debug_ptr = debug_buffer;
debug_prefix_length = 0;
}
+errno = save_errno;
}
/* End of debug.c */