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

Cleanup the code to return explicit error values #519

Open
GoogleCodeExporter opened this issue Nov 21, 2015 · 2 comments
Open

Cleanup the code to return explicit error values #519

GoogleCodeExporter opened this issue Nov 21, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

What new or enhanced feature are you proposing?
It is necessary to improve error reporting in existent code base. In many 
places when the cause of error is unknown the implementation chooses to return 
-1 value. It coincides with value -EPERM, and higher level routine interpreting 
error code often misinterprets it or ends up printing "Not permitted" (result 
of calling strerror(EPERM)). Therefore typically the message gives improper 
diagnostics, confuses the user and distracts it from the real reason of the 
failure. Other manifestation is that there are places which do 'return -1' 
implying 'return -EPERM', therefore code lacks clarity.

What goals would this enhancement help you to achieve?
Improve error diagnostics.
Improve code clarity.

How are you going to implement the enhancement?
EPERM definition in errno.h is temporarily changed, therefore "Unknown error 
code. PLEASE REPORT!" will be printed instead. Developers and uses are 
encouraged to report these cases.
As it is generally impossible to automatically distinguish between correct and 
erroneous use of 'return -1', only manual cleanup can completelty solve the 
problem.

Original issue reported on code.google.com by [email protected] on 9 Jan 2013 at 3:08

@GoogleCodeExporter
Copy link
Author

Another source of "Unknown error code" is found. There are places where 
implementation interprets return value of some function as error code, whereas 
function specification doesn't say so (typically separate quering of "errno" is 
required to obtain actual error code). These occasions should also be fixed 
or/and reported.

Original comment by [email protected] on 10 Jan 2013 at 11:51

@GoogleCodeExporter
Copy link
Author

Original comment by Eldar.Abusalimov on 22 Jan 2013 at 9:19

  • Changed state: Accepted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant