diff options
author | Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> | 2018-07-07 20:22:25 -0300 |
---|---|---|
committer | Arkadiusz Hiler <arkadiusz.hiler@intel.com> | 2018-07-11 15:37:32 +0300 |
commit | d0f8fc9c88cbeec01486477007effc3b7914a8be (patch) | |
tree | fbb25b49aa405a71ef12e06833198bd775e6e2ad /lib/igt_core.c | |
parent | be9296a1e1e4d288d4baee3aba89480f007dea6c (diff) |
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 <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'lib/igt_core.c')
-rw-r--r-- | lib/igt_core.c | 6 |
1 files changed, 3 insertions, 3 deletions
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); } |