[igt-dev] [PATCH i-g-t 1/7] Remove parameter aliases with another argument

Rodrigo Siqueira rodrigosiqueiramelo at gmail.com
Sat Jul 7 23:22:25 UTC 2018


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.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo at gmail.com>
---
 lib/igt_core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 3313050c..fa22f12d 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[1024], 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);
 }
 
-- 
2.18.0



More information about the igt-dev mailing list