davidmoreno / onion

C library to create simple HTTP servers and Web Applications.
http://www.coralbits.com/libonion/
Other
2.01k stars 250 forks source link

improve ONION_ERROR message in onion_response_flush, save errno... #295

Closed bstarynk closed 2 years ago

bstarynk commented 2 years ago

This gives a more readable error message. Could be useful for the Bismon static source code analyzer (for C and C++) on https://github.com/bstarynk/bismon/ and perhaps in the RefPerSys symbolic artificial intelligence project on http://refpersys.org/

davidmoreno commented 2 years ago

Why does it need to save and restore errno?

bstarynk commented 2 years ago

On 29/09/2021 15:44, David Moreno Montero wrote:

Why does it need to save and restore errno?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/davidmoreno/onion/pull/295#issuecomment-930189592, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAWCLCHMVCRSY7F5KFOS4TUEMJ2RANCNFSM5E7WIM3Q. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Because I don't understand the policy regarding errno in libonion.

In my opinion, that policy should be documented (perhaps it is, but I forgot about it).

-- Basile Starynkevitch @.***> (only mine opinions / les opinions sont miennes uniquement) 92340 Bourg-la-Reine, France web page: starynkevitch.net/Basile/

davidmoreno commented 2 years ago

There is no official policy for errno.. but it just does nothing with it.

This way when it returns you have an error reason.

And was thinking of asking to leave it as is and ask for not saving errno... but I do see some value in that the logging does not change errno, so for example if a onion_write fails, and we log it, we still have the errno of the reason for the failure to write into the socket.

So all good!