summaryrefslogtreecommitdiff
path: root/test/cairo-test-runner.c
diff options
context:
space:
mode:
authorGeorge Matsumura <gmmatsumura01@bvsd.org>2020-08-30 18:29:05 -0600
committerUli Schlachter <psychon@znc.in>2020-09-02 10:29:04 +0000
commitf2cb9ba49a222c6e17603f5fb8cbb02f82d0bbf7 (patch)
treee0aa9eeb969ab733bd424a04d90f13c9933aa57c /test/cairo-test-runner.c
parentb87e53dc1cc4dd33fa391f3ee8db02394b44a742 (diff)
downloadcairo-f2cb9ba49a222c6e17603f5fb8cbb02f82d0bbf7.tar.gz
meson: Fix musl build
This constitutes few fixes that are necessary to compile correctly and reduce errors when using musl libc. Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
Diffstat (limited to 'test/cairo-test-runner.c')
-rw-r--r--test/cairo-test-runner.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/cairo-test-runner.c b/test/cairo-test-runner.c
index b1f77b358..6d4134ad9 100644
--- a/test/cairo-test-runner.c
+++ b/test/cairo-test-runner.c
@@ -164,11 +164,13 @@ static cairo_bool_t
is_running_under_debugger (void)
{
#if HAVE_UNISTD_H && HAVE_LIBGEN_H && __linux__
- char buf[1024];
+ char buf[1024] = { 0 };
+ char buf2[1024] = { 0 };
sprintf (buf, "/proc/%d/exe", getppid ());
- if (readlink (buf, buf, sizeof (buf)) != -1 &&
- strncmp (basename (buf), "gdb", 3) == 0)
+ if (readlink (buf, buf2, sizeof (buf2)) != -1 &&
+ buf2[1023] == 0 &&
+ strncmp (basename (buf2), "gdb", 3) == 0)
{
return TRUE;
}