Skip to content

Commit f356c69

Browse files
committed
Wrap assignment inside if in parentheses for clarity
and also test against `nullptr` (even though that's zero, thus false by definition). To silence the coverity scan warning.
1 parent 940c6cb commit f356c69

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

judge/runguard.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ int main(int argc, char **argv)
12891289
* exceeded, when running via SSH. */
12901290
FILE *fp = nullptr;
12911291
const char *oom_score_path = "/proc/self/oom_score_adj";
1292-
if ( fp = fopen(oom_score_path, "r+") ) {
1292+
if ( (fp = fopen(oom_score_path, "r+"))!=nullptr ) {
12931293
if ( fscanf(fp,"%d", &ret)!=1 ) error(errno,"cannot read from `%s'", oom_score_path);
12941294
if ( ret<0 ) {
12951295
int oom_reset_value = 0;

0 commit comments

Comments
 (0)