D6197: Add kauth helper to file ioslave

Chinmoy Ranjan Pradhan noreply at phabricator.kde.org
Sun Aug 6 16:35:58 UTC 2017


chinmoyr added inline comments.

INLINE COMMENTS

> dfaure wrote in filehelper.cpp:86
> The documentation for chown and others says:
> 
> Upon successful completion, these functions shall return 0.  Otherwise, these functions shall return −1 and set errno to indicate the error.
> 
> It does NOT say, that errno isn't set when the function is successful. It seems to me that it would be perfectly valid for a libc implementation to do something like "try this, it fails (and sets errno), then try that, it worked, return 0".
> 
> For this reason I would feel much safer (especially in code run by root!) if the error handling was more classic, i.e. by checking return values.

> It does NOT say, that errno isn't set when the function is successful. It seems to me that it would be perfectly valid for a libc implementation to do something like "try this, it fails (and sets errno), then try that, it worked, return 0".

It is valid and isn't that uncommon.

> For this reason I would feel much safer (especially in code run by root!) if the error handling was more classic, i.e. by checking return values.

Currently helper sets the error and slave terminates due to Kauth::ErrorReply. Do you want this to not happen, like in case where chown succeeds but errno is set? And what error code should I check for and whether it should be for each case or at the end of method?

REVISION DETAIL
  https://phabricator.kde.org/D6197

To: chinmoyr, elvisangelaccio, #frameworks, dfaure
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170806/dc3341f5/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list