diff mbox

[kvm-unit-tests,v2,1/2] report: add lock to report_abort

Message ID 1479824506-19690-2-git-send-email-drjones@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Jones Nov. 22, 2016, 2:21 p.m. UTC
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 lib/report.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Thomas Huth Nov. 22, 2016, 2:48 p.m. UTC | #1
On 22.11.2016 15:21, Andrew Jones wrote:
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
>  lib/report.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/report.c b/lib/report.c
> index 4cd75534f978..2a8b6df1368d 100644
> --- a/lib/report.c
> +++ b/lib/report.c
> @@ -118,12 +118,14 @@ void report_abort(const char *msg_fmt, ...)
>  {
>  	va_list va;
>  
> +	spin_lock(&lock);
>  	puts("ABORT: ");
>  	puts(prefixes);
>  	va_start(va, msg_fmt);
>  	vprintf(msg_fmt, va);
>  	va_end(va);
>  	puts("\n");
> +	spin_unlock(&lock);
>  	report_summary();
>  	abort();
>  }
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/lib/report.c b/lib/report.c
index 4cd75534f978..2a8b6df1368d 100644
--- a/lib/report.c
+++ b/lib/report.c
@@ -118,12 +118,14 @@  void report_abort(const char *msg_fmt, ...)
 {
 	va_list va;
 
+	spin_lock(&lock);
 	puts("ABORT: ");
 	puts(prefixes);
 	va_start(va, msg_fmt);
 	vprintf(msg_fmt, va);
 	va_end(va);
 	puts("\n");
+	spin_unlock(&lock);
 	report_summary();
 	abort();
 }