diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2016-03-02 23:36:19 +0100 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2016-03-02 23:36:19 +0100 |
commit | f7636162ba124c0d6b5accaa72c842033f3e2309 (patch) | |
tree | 9ae5ceddde46e7c511bba899b869f54c6fef6283 /pcilib/error.c | |
parent | 7e39a6c8ae5c3f95b3b2895c4ce8d858c7ad3b79 (diff) | |
parent | 02d0026e2df2ba5c68c0c1a67aec4437c9e8e8f3 (diff) | |
download | pcitool-f7636162ba124c0d6b5accaa72c842033f3e2309.tar.gz pcitool-f7636162ba124c0d6b5accaa72c842033f3e2309.tar.bz2 pcitool-f7636162ba124c0d6b5accaa72c842033f3e2309.tar.xz pcitool-f7636162ba124c0d6b5accaa72c842033f3e2309.zip |
Further improvements of Python scripting and web-interface API for register manipulations by Vasiliy Chernov
Diffstat (limited to 'pcilib/error.c')
-rw-r--r-- | pcilib/error.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/pcilib/error.c b/pcilib/error.c index ae8bacb..8d25c82 100644 --- a/pcilib/error.c +++ b/pcilib/error.c @@ -12,8 +12,17 @@ #define PCILIB_LOGGER_HISTORY 16 void pcilib_print_error(void *arg, const char *file, int line, pcilib_log_priority_t prio, const char *msg, va_list va) { - vprintf(msg, va); - printf(" [%s:%d]\n", file, line); + size_t size = strlen(msg) + strlen(file) + 64; + char *stmp = alloca(size * sizeof(char*)); + + if (stmp) { + sprintf(stmp, "%s [%s:%d]\n", msg, file, line); + vprintf(stmp, va); + } else { + // Bad for multithreading... + vprintf(msg, va); + printf(" [%s:%d]\n", file, line); + } } static void *pcilib_logger_argument = NULL; |