aboutsummaryrefslogtreecommitdiff
path: root/toys/other
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-11-24 17:23:23 -0600
committerRob Landley <rob@landley.net>2014-11-24 17:23:23 -0600
commit9ab563b8a170aee0b8b82ca32e9f70a689112b6a (patch)
treeab10dc069b2bd42108e4b422f59ec255249ccb6f /toys/other
parentf6c28b6e0017ac36190ee31132721a1c9e30f2b6 (diff)
downloadtoybox-9ab563b8a170aee0b8b82ca32e9f70a689112b6a.tar.gz
Tweak the "ignoring return value" fortify workaround for readlinkat.
We zero the buffer and if the link read fails that's left alone, so it's ok for the symlink not to be there. Unfortunately, typecasting the return value to (void) doesn't shut up gcc, and having an if(); with the semicolon on the same line doesn't shut up llvm. (The semicolon on a new line would, but C does not have significant whitespace and I'm not going to humor llvm if it plans to start.) So far, empty curly brackets consistently get the warning to shut up.
Diffstat (limited to 'toys/other')
-rw-r--r--toys/other/lspci.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/other/lspci.c b/toys/other/lspci.c
index 6a265a1d..c9b22abf 100644
--- a/toys/other/lspci.c
+++ b/toys/other/lspci.c
@@ -53,7 +53,7 @@ int do_lspci(struct dirtree *new)
// it's ok for the driver link not to be there, whatever fortify says
*driver = 0;
if (toys.optflags & FLAG_k)
- if (readlinkat(dirfd, "driver", driver, sizeof(driver)));
+ if (readlinkat(dirfd, "driver", driver, sizeof(driver))) {};
for (fields = (char*[]){"class", "vendor", "device", 0}; *fields; fields++) {
int fd, size = 6 + 2*((toys.optflags & FLAG_e) && p == toybuf);