-
-
Notifications
You must be signed in to change notification settings - Fork 441
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
Silence clang analyzer warnings #1521
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
linux/LinuxProcessTable.c:795:11: warning: File position of the stream might be 'indeterminate' after a failed operation. Can cause undefined behavior [unix.Stream] 795 | while (fgets(buffer, sizeof(buffer), fp)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ linux/LinuxProcessTable.c:795:11: warning: Read function called when stream is in EOF state. Function has no effect [unix.Stream] 795 | while (fgets(buffer, sizeof(buffer), fp)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ linux/LinuxProcessTable.c:840:11: warning: File position of the stream might be 'indeterminate' after a failed operation. Can cause undefined behavior [unix.Stream] 840 | while (fgets(linebuf, sizeof(linebuf), file) != NULL) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ linux/LinuxProcessTable.c:840:11: warning: Read function called when stream is in EOF state. Function has no effect [unix.Stream] 840 | while (fgets(linebuf, sizeof(linebuf), file) != NULL) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ linux/LinuxMachine.c:81:22: warning: The 1st argument to 'openat' is between -99 and -1 but should be a valid file descriptor or AT_FDCWD [unix.StdCLibraryFunctions] 81 | int cpuDirFd = openat(dirfd(dir), entry->d_name, O_DIRECTORY | O_PATH | O_NOFOLLOW); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ linux/LinuxMachine.c:501:11: warning: File position of the stream might be 'indeterminate' after a failed operation. Can cause undefined behavior [unix.Stream] 501 | while (fgets(buffer, sizeof(buffer), file)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ linux/LinuxMachine.c:501:11: warning: Read function called when stream is in EOF state. Function has no effect [unix.Stream] 501 | while (fgets(buffer, sizeof(buffer), file)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ linux/Platform.c:467:22: warning: File position of the stream might be 'indeterminate' after a failed operation. Can cause undefined behavior [unix.Stream] 467 | } while ((bytes = fread(env + size, 1, capacity - size, fp)) > 0); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ linux/Platform.c:467:22: warning: Read function called when stream is in EOF state. Function has no effect [unix.Stream] 467 | } while ((bytes = fread(env + size, 1, capacity - size, fp)) > 0); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ linux/Platform.c:585:15: warning: File position of the stream might be 'indeterminate' after a failed operation. Can cause undefined behavior [unix.Stream] 585 | total = fscanf(fp, "full avg10=%32lf avg60=%32lf avg300=%32lf total=%*f ", ten, sixty, threehundred); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ linux/Platform.c:585:15: warning: Read function called when stream is in EOF state. Function has no effect [unix.Stream] 585 | total = fscanf(fp, "full avg10=%32lf avg60=%32lf avg300=%32lf total=%*f ", ten, sixty, threehundred); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ linux/Platform.c:789:21: warning: The 1st argument to 'openat' is between -99 and -1 but should be a valid file descriptor or AT_FDCWD [unix.StdCLibraryFunctions] 789 | int entryFd = openat(dirfd(dir), entryName, O_DIRECTORY | O_PATH); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BenBE
reviewed
Aug 15, 2024
Explorer09
reviewed
Aug 16, 2024
Explorer09
reviewed
Aug 16, 2024
BenBE
added
enhancement
Extension or improvement to existing feature
code quality ♻️
Code quality enhancement
build system 🔧
Affects the build system rather then the user experience
Linux 🐧
Linux related issues
labels
Sep 18, 2024
This doesn't yet resolve all of the clang issues (tested with |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
build system 🔧
Affects the build system rather then the user experience
code quality ♻️
Code quality enhancement
enhancement
Extension or improvement to existing feature
Linux 🐧
Linux related issues
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Split from #1513