-
Notifications
You must be signed in to change notification settings - Fork 8
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
add checking of return status on fstat calls #7
Conversation
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.
Hey @ncroxon,
There is one small issue. Please fix it and we are ready to go :)
Assemble.c
Outdated
|
||
if (fstat(mdfd, &stb2) != 0) { | ||
goto error; | ||
} |
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.
You don't need braces in this case, there is one instruction inside if but it is not an issue, just FYI,
Dump.c
Outdated
@@ -110,9 +111,17 @@ int Dump_metadata(char *dev, char *dir, struct context *c, | |||
free(fname); | |||
return 1; | |||
} | |||
if (c->verbose >= 0) | |||
if (c->verbose >= 0) { |
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.
Oh, bracases here totally change the flow.
Previously, only printf()
was executed verbose >=0. Now, the fsttat is executed. I think that it should be:
if (c->verbose >= 0) { | |
if (c->verbose >= 0) | |
printf("%s saved as %s.\n", dev, fname); | |
close(fl); | |
ret = fstat(fd, &dstb); | |
close(fd); | |
if (ret) { | |
unlink(fname); | |
free(fname); | |
return 1; | |
} |
I pushed a new version (V3) to the branch. |
I will cherry-pick this commit so please remove [PATCH V3] from title and v2 and v3 changes from description. |
There are a few places we don't check the return status when calling fstat for success. Clean up the calls by adding a check before continuing. Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
There are a few places we don't check the return status when calling fstat for success. Clean up the calls by adding a check before continuing.
V2: clean up warnings/errors from checkpatch.pl