diff mbox

[i-g-t] igt_core: Fix logging to display extended line

Message ID 1450884888-18931-1-git-send-email-derek.j.morton@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Derek Morton Dec. 23, 2015, 3:34 p.m. UTC
line[strlen(line)] will always evaluate to NULL so line_continuation
was always true. That prevented the program name, pid and log level
ever being printed.
Changed to [strlen(line) - 1] so the last character before the null
terminator is compared with '\n' to determine line_continuation.

Signed-off-by: Derek Morton <derek.j.morton@intel.com>
---
 lib/igt_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel Vetter Jan. 5, 2016, 3:07 p.m. UTC | #1
On Wed, Dec 23, 2015 at 03:34:48PM +0000, Derek Morton wrote:
> line[strlen(line)] will always evaluate to NULL so line_continuation
> was always true. That prevented the program name, pid and log level
> ever being printed.
> Changed to [strlen(line) - 1] so the last character before the null
> terminator is compared with '\n' to determine line_continuation.
> 
> Signed-off-by: Derek Morton <derek.j.morton@intel.com>

Ooops. Applied, thanks for the patch.
-Daniel

> ---
>  lib/igt_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 84cf8d2..221ed7e 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -1748,7 +1748,7 @@ void igt_vlog(const char *domain, enum igt_log_level level, const char *format,
>  		goto out;
>  	}
>  
> -	line_continuation = line[strlen(line)] != '\n';
> +	line_continuation = line[strlen(line) - 1] != '\n';
>  
>  	/* append log buffer */
>  	_igt_log_buffer_append(formatted_line);
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 84cf8d2..221ed7e 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -1748,7 +1748,7 @@  void igt_vlog(const char *domain, enum igt_log_level level, const char *format,
 		goto out;
 	}
 
-	line_continuation = line[strlen(line)] != '\n';
+	line_continuation = line[strlen(line) - 1] != '\n';
 
 	/* append log buffer */
 	_igt_log_buffer_append(formatted_line);