From d0f8fc9c88cbeec01486477007effc3b7914a8be Mon Sep 17 00:00:00 2001 From: Rodrigo Siqueira Date: Sat, 7 Jul 2018 20:22:25 -0300 Subject: Remove parameter aliases with another argument This commit fixes the following GCC warning: warning: passing argument 2 to restrict-qualified parameter aliases with argument 1 [-Wrestrict] return (readlink (buf, buf, sizeof (buf)) != -1 && This commit fixes the GCC warning by creating a second buffer only to keep the path. v2: make pathname smaller (A. Hiler) Signed-off-by: Rodrigo Siqueira Signed-off-by: Arkadiusz Hiler Acked-by: Arkadiusz Hiler --- lib/igt_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/igt_core.c') diff --git a/lib/igt_core.c b/lib/igt_core.c index 3313050c..2d0d78a3 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -1169,10 +1169,10 @@ bool igt_can_fail(void) static bool run_under_gdb(void) { - char buf[1024]; + char pathname[30], buf[1024]; - sprintf(buf, "/proc/%d/exe", getppid()); - return (readlink (buf, buf, sizeof (buf)) != -1 && + sprintf(pathname, "/proc/%d/exe", getppid()); + return (readlink(pathname, buf, sizeof (buf)) != -1 && strncmp(basename(buf), "gdb", 3) == 0); } -- cgit v1.2.3