Ulrich Windl wrote:
> On 28 Jan 2009 at 22:51, Hans de Goede wrote:
> 
>> Hi All,
>>
>> While testing I noticed that idbm_lock() uses exit when it cannot lock, 
>> leading 
>> to interesting effect when using it from libiscsi, when typing "import 
>> libiscsi" in python as normal user, my entire python interpreter exited, not 
>> good.
>>
>> The attached patch instead returns an error code, and fixes all callers to 
>> check this.
> 
> Hi!
> 
> Let me comment on this:
>               if (errno != EEXIST) {
> +                     log_error("Maybe you are not root?");
> 
> In case of an error, don't try to spewculate, but give details (i.e. "errno") 
> instead. Would something be wrong with using strerror(errno) here?
> 

We do that in the next line logged, also note that this message was already 
there, only the order of the 2 messages is being changed, so that libiscsi 
(which saves the last log_error message) gives a reasonable error when this 
happens.

> Also, for a library when returning error codes, there is no need to print 
> messages 
 > (unless there is a generic error reporting framework that can be customized).

This is not being printed, instead the last log_error message is kept in a 
buffer for the application to retrieve when it wants something more verbose 
then just strerror to show to the user.

Regards,

Hans


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~----------~----~----~----~------~----~------~--~---

Reply via email to