diff options
author | Kelvin M. Klann <kmk3.code@protonmail.com> | 2022-05-07 17:47:32 -0300 |
---|---|---|
committer | Kelvin M. Klann <kmk3.code@protonmail.com> | 2022-05-10 12:02:53 +0000 |
commit | a33d7ebb046f3a1b08b5ffd5b5ceadb8bb5720a2 (patch) | |
tree | 2009599b03b86ef3cc8881522d8e92c07e6732fa /src | |
parent | always log seccomp errors (#5110) (diff) | |
download | firejail-a33d7ebb046f3a1b08b5ffd5b5ceadb8bb5720a2.tar.gz firejail-a33d7ebb046f3a1b08b5ffd5b5ceadb8bb5720a2.tar.zst firejail-a33d7ebb046f3a1b08b5ffd5b5ceadb8bb5720a2.zip |
fzenity: fix dead store
As caught by the Clang Static Analyzer:
$ make clean && NO_EXTRA_CFLAGS="yes" scan-build --status-bugs make -C src/fzenity
[...]
main.c:77:10: warning: Value stored to 'ptr' is never read [deadcode.DeadStores]
return ptr++;
^~~~~
1 warning generated.
[...]
scan-build: Analysis run complete.
scan-build: 1 bug found.
The above increment is a no-op, as it is equivalent to
`return ptr; ptr++;`.
For it to make any difference, the prefix increment operator would have
to be used in place of the postfix one:
return ++ptr;
Which would be equivalent to `++ptr; return ptr;`.
But in order to fix the warning (and CI) while avoiding to change the
current behavior, just remove the operator instead.
Added on commit 1cdfa6f95 ("more on firecfg --guide: fzenity",
2022-04-25).
Diffstat (limited to 'src')
-rw-r--r-- | src/fzenity/main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/fzenity/main.c b/src/fzenity/main.c index 9d897b503..cf024c32c 100644 --- a/src/fzenity/main.c +++ b/src/fzenity/main.c | |||
@@ -74,7 +74,7 @@ char *print_line(char *in, int col) { | |||
74 | if (*ptr == '\n') { | 74 | if (*ptr == '\n') { |
75 | *ptr++ = '\0'; | 75 | *ptr++ = '\0'; |
76 | printf("%s\n", in); | 76 | printf("%s\n", in); |
77 | return ptr++; | 77 | return ptr; |
78 | } | 78 | } |
79 | else if (i == col) { | 79 | else if (i == col) { |
80 | while (*ptr != ' ' && ptr != in) | 80 | while (*ptr != ' ' && ptr != in) |