diff options
| author | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2018-10-06 15:34:49 -0500 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2018-10-21 10:25:07 -0300 |
| commit | daec80eedabcafaf85ac58802451d165e0696745 (patch) | |
| tree | 4b75ae53f56d6ff25def901e22939c8a48b28552 /debugger.c | |
| parent | f5411574afd34d580e3c1256c4f0807974099fcf (diff) | |
Avoid spurious gcc warning in debugger.c
Without this patch, gcc 8.2.0-7 complains:
debugger.c: In function ‘debugger_is_active’:
debugger.c:40:24: warning: passing argument 2 to restrict-qualified parameter aliases with argument 1 [-Wrestrict]
if (readlink (buf, buf, sizeof (buf)) != -1 &&
~~~ ^~~
This is pretty silly, but it seems simplest to just avoid passing the
same buffer to readlink as both pathname and buf.
Diffstat (limited to 'debugger.c')
| -rw-r--r-- | debugger.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -32,13 +32,14 @@ bool debugger_is_active (void) { char buf[1024]; + char buf2[1024]; if (RUNNING_ON_VALGRIND) return true; 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 && + strncmp (basename (buf2), "gdb", 3) == 0) { return true; } |
