[clinfo] 06/55: Work-group kernel: don't clobber strbuf

Andreas Beckmann anbe at moszumanska.debian.org
Sat Jan 13 14:39:59 UTC 2018


This is an automated email from the git hooks/post-receive script.

anbe pushed a commit to branch master
in repository clinfo.

commit dbaa7ece720554aa0c787caf7daad31e5cda6669
Author: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
Date:   Wed Oct 5 07:03:23 2016 +0200

    Work-group kernel: don't clobber strbuf
    
    Othewise the log would appear in the work-size multiple output. Shadow
    the variables instead.
    
    Also flush stdout and stderr as appropriate.
---
 src/clinfo.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/clinfo.c b/src/clinfo.c
index 98c1b3f..55a4d8f 100644
--- a/src/clinfo.c
+++ b/src/clinfo.c
@@ -508,11 +508,18 @@ getWGsizes(cl_platform_id pid, cl_device_id dev)
 
 	/* for a program build failure, dump the log to stderr before bailing */
 	if (error == CL_BUILD_PROGRAM_FAILURE) {
+		/* Do not clobber strbuf, shadow it */
+		char *strbuf = NULL;
+		size_t bufsz = 0, nusz = 0;
 		GET_STRING(clGetProgramBuildInfo, CL_PROGRAM_BUILD_LOG, "CL_PROGRAM_BUILD_LOG", prg, dev);
 		if (error == CL_SUCCESS) {
+			fflush(stdout);
+			fflush(stderr);
 			fputs("=== CL_PROGRAM_BUILD_LOG ===\n", stderr);
 			fputs(strbuf, stderr);
+			fflush(stderr);
 		}
+		free(strbuf);
 	}
 	if (had_error)
 		goto out;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/clinfo.git



More information about the Pkg-opencl-commits mailing list