Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Werror=nonnull in close_command_file #430

Merged
merged 1 commit into from
May 22, 2023
Merged

Conversation

sni
Copy link
Contributor

@sni sni commented May 19, 2023

add check if fp is not NULL because of:

[   92s] In function 'close_command_file',
[   92s]     inlined from 'close_command_file' at src/naemon/commands.c:171:5:
[   92s] src/naemon/commands.c:186:9: error: argument 1 null where non-null expected [-Werror=nonnull]
[   92s]   186 |         fclose(command_file_fp);
[   92s]       |         ^~~~~~~~~~~~~~~~~~~~~~~
[   92s] In file included from src/naemon/objects_host.h:8,
[   92s]                  from src/naemon/comments.h:9,
[   92s]                  from src/naemon/commands.c:3:
[   92s] /usr/include/stdio.h: In function 'close_command_file':
[   92s] /usr/include/stdio.h:183:12: note: in a call to function 'fclose' declared 'nonnull'
[   92s]   183 | extern int fclose (FILE *__stream) __nonnull ((1));
[   92s]       |            ^~~~~~
[   93s] cc1: all warnings being treated as errors

add check if fp is not NULL because of:

```
[   92s] In function 'close_command_file',
[   92s]     inlined from 'close_command_file' at src/naemon/commands.c:171:5:
[   92s] src/naemon/commands.c:186:9: error: argument 1 null where non-null expected [-Werror=nonnull]
[   92s]   186 |         fclose(command_file_fp);
[   92s]       |         ^~~~~~~~~~~~~~~~~~~~~~~
[   92s] In file included from src/naemon/objects_host.h:8,
[   92s]                  from src/naemon/comments.h:9,
[   92s]                  from src/naemon/commands.c:3:
[   92s] /usr/include/stdio.h: In function 'close_command_file':
[   92s] /usr/include/stdio.h:183:12: note: in a call to function 'fclose' declared 'nonnull'
[   92s]   183 | extern int fclose (FILE *__stream) __nonnull ((1));
[   92s]       |            ^~~~~~
[   93s] cc1: all warnings being treated as errors
```

Signed-off-by: Sven Nierlein <[email protected]>
Copy link

@jdumalaonITRS jdumalaonITRS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sni sni merged commit 192f25c into naemon:master May 22, 2023
1 check passed
@sni sni deleted the fix_nonnull branch February 9, 2024 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants