#define __ABORT_NOW(file, line, ...) do { \
if (sizeof("" __VA_ARGS__) > 1) \
- complain(DBG_FATL_ABT, "\nABORT at " file ":" #line ": " __VA_ARGS__ "\n"); \
+ complain(DBG_FATL_ABT, "ABORT at " file ":" #line ": " __VA_ARGS__); \
ha_backtrace_to_stderr(1); \
abort_with_line(__LINE__); \
} while (0)
#define __BUG_ON(cond, file, line, details, pfx, sfx, ...) do { \
const char *msg; \
if (sizeof("" __VA_ARGS__) > 1) \
- msg ="\n" pfx "condition \"" #cond "\" matched at " file ":" #line "" sfx "\n" __VA_ARGS__ "\n"; \
+ msg = pfx "condition \"" #cond "\" matched at " file ":" #line "" sfx "\n" __VA_ARGS__; \
else \
- msg = "\n" pfx "condition \"" #cond "\" matched at " file ":" #line "" sfx "\n"; \
+ msg = pfx "condition \"" #cond "\" matched at " file ":" #line "" sfx; \
complain(details, msg); \
if (details & DBG_DET_FAT_FATL) \
ABORT_NOW(); \
static int __match_count_##line; \
const char *msg; \
if (sizeof("" __VA_ARGS__) > 1) \
- msg ="\n" pfx "condition \"" #cond "\" matched at " file ":" #line "" sfx "\n" __VA_ARGS__ "\n"; \
+ msg = pfx "condition \"" #cond "\" matched at " file ":" #line "" sfx "\n" __VA_ARGS__; \
else \
- msg = "\n" pfx "condition \"" #cond "\" matched at " file ":" #line "" sfx "\n"; \
+ msg = pfx "condition \"" #cond "\" matched at " file ":" #line "" sfx; \
if (_HA_ATOMIC_FETCH_ADD(&__match_count_##line, 1)) \
break; \
complain(details, msg); \
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/uio.h>
#include <sys/utsname.h>
#include <sys/wait.h>
#include <unistd.h>
DISGUISE(write(2, buf.area, buf.data));
}
-/* Complain with message <msg> on stderr. <details> is only
- * checked on DBG_DET_TYP_BUG, and will taint the process either for a
- * bug or warn.
+/* Complain with message <msg> on stderr with a '\n' at the begin and at the
+ * end. Depending on the fatality, and type of the event in <details>, a
+ * different prefix will be appended. Then the event type may result in some
+ * taining of the process to happen.
*/
void complain(uint details, const char *msg)
{
- DISGUISE(write(2, msg, strlen(msg)));
+ struct iovec iovec[10];
+ int vec = 0;
+
+ iovec[vec].iov_base = "\n";
+ iovec[vec].iov_len = 1;
+ vec++;
+
+ iovec[vec].iov_base = (char *)msg;
+ iovec[vec].iov_len = strlen(msg);
+ vec++;
+
+ iovec[vec].iov_base = "\n";
+ iovec[vec].iov_len = 1;
+ vec++;
+
+ DISGUISE(writev(2, iovec, vec));
+
if (details & (DBG_DET_TYP_BUG|DBG_DET_TYP_ABT))
mark_tainted(TAINTED_BUG);
else if (details & DBG_DET_TYP_WRN)