summaryrefslogtreecommitdiff
path: root/clients/simple-egl.c
diff options
context:
space:
mode:
authorPekka Paalanen <pekka.paalanen@collabora.com>2019-09-23 17:24:50 +0300
committerPekka Paalanen <pekka.paalanen@collabora.com>2019-09-23 17:27:09 +0300
commit1ca4ed2015432283aa9999580f86a8d49d960e07 (patch)
tree85d2f6a69bbe9028291051fdf5120b66357c4792 /clients/simple-egl.c
parente62f276a21ca60b8ab9a8d3baba4496d28875a3b (diff)
downloadweston-1ca4ed2015432283aa9999580f86a8d49d960e07.tar.gz
clients: fix len-string formatting
All these have the printf format string wrong. "%*s" sets the field width but does not limit the string to len bytes. You need to set precision instead to limit to len bytes: "%.*s". Found by grepping, after wondering why my WIP prints printed garbage at the end. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Diffstat (limited to 'clients/simple-egl.c')
-rw-r--r--clients/simple-egl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/clients/simple-egl.c b/clients/simple-egl.c
index 2a23166e..cd7408e9 100644
--- a/clients/simple-egl.c
+++ b/clients/simple-egl.c
@@ -243,7 +243,7 @@ create_shader(struct window *window, const char *source, GLenum shader_type)
char log[1000];
GLsizei len;
glGetShaderInfoLog(shader, 1000, &len, log);
- fprintf(stderr, "Error: compiling %s: %*s\n",
+ fprintf(stderr, "Error: compiling %s: %.*s\n",
shader_type == GL_VERTEX_SHADER ? "vertex" : "fragment",
len, log);
exit(1);
@@ -272,7 +272,7 @@ init_gl(struct window *window)
char log[1000];
GLsizei len;
glGetProgramInfoLog(program, 1000, &len, log);
- fprintf(stderr, "Error: linking:\n%*s\n", len, log);
+ fprintf(stderr, "Error: linking:\n%.*s\n", len, log);
exit(1);
}