-
-
Notifications
You must be signed in to change notification settings - Fork 362
CQ: we should check the return value of lseek #5783
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
base: main
Are you sure you want to change the base?
Conversation
An attempt to unify checks and error messages
Perhaps this already revealed some errors. It fails tests:
|
Yes, as it just checks if a return value does not indicate on an error, this really is a bug in r.random. If I read the code correctly, there is no need to call |
Rewinding a raster map can lead to lseek errors and generally should not be done, as raster reading functions perform seek on their own if required.
MacOS failure is caused by #5787 |
Concerning the message that you applied almost everywhere, isn't it similar to one of your examples last week where |
There shouldn’t be any reason to cast |
That is if we don't want to be K&R compatible any more ;-) |
* no need to cast -1 to off_t as we do not use K&R C * make error message arguments relocable * unify error messges * add missing includes for error reporting
Apparently |
I think I read since that comment, that they support positional placeholders, but through a different function name that supports positional explicitly (or maybe even exclusively). I don't think there's this distinction in other platforms |
What do you think about the message? I think that everyone needs that comment about what this refers to, not only the translators. |
If you refer here to MS C compiler, then yes – we will have to IFDEF code in G_message et al. From the documentation: „By default, if no positional formatting is present, the positional functions behave identically to the non-positional ones.“ Thus there would be no problems to replace |
I am not good at this. Like „File seek error with code %d: %s“? |
What about: "File seek error: %s (%d)", which would have resulted in e.g. "ERROR: File seek error: Illegal seek (29)"? |
Or skip the ambivalent word "seek" with e.g. "File read/write operation failed: %s (%d)", giving "ERROR: File read/write operation failed: Illegal seek (29)". |
Replacing the word "seek" is the way go. More specificity about what file and where would be nice, but as a general and quick way how to implement this, the last suggestion is good. |
An attempt to unify checks and error messages.
There are more places where
lseek
return value should be checked, but I don't have time to work on them now.