-
Notifications
You must be signed in to change notification settings - Fork 247
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
CI: Add github code quality analysis (codeql) #584
base: master
Are you sure you want to change the base?
Conversation
The following patch should solve one of the issues reported in the codeql scan. It also removes usage of diff --git a/src/swclock/swclock.c b/src/swclock/swclock.c
index e526bd38..83b15c95 100644
--- a/src/swclock/swclock.c
+++ b/src/swclock/swclock.c
@@ -78,14 +78,12 @@ int main(int argc, char **argv)
eerrorx("swclock: Reference file was not specified");
if (sflag) {
- if (stat(file, &sb) == -1) {
- opt = open(file, O_WRONLY | O_CREAT, 0644);
- if (opt == -1)
- eerrorx("swclock: open: %s", strerror(errno));
- close(opt);
- } else
- if (utime(file, NULL) == -1)
- eerrorx("swclock: utime: %s", strerror(errno));
+ int fd = open(file, O_WRONLY | O_CREAT, 0644);
+ if (fd == -1)
+ eerrorx("swclock: open: %s", strerror(errno));
+ if (futimens(fd, NULL) == -1)
+ eerrorx("swclock: futimens: %s", strerror(errno));
+ close(fd);
return 0;
}
Footnotes |
can you send a PR ? we're not going to copy & paste patches from comments ... |
Sure. I was thinking @thesamesam might have wanted to add that to this PR since it's somewhat related. EDIT: done at #591 |
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ "master" ] | ||
schedule: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need a schedule for it when it already fires on pushes & pull requests ?
@@ -0,0 +1,52 @@ | |||
name: "CodeQL" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should have a comment block at the top explaining what this is about and links to relevant docs
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
|
||
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move URL to next line
No description provided.