Re: [PATCH] dropbear-051: errno bug fix

2008-09-21 Thread Farrell Aultman
Thanks Jamie, I agree with everything you said.  The code would be better
modified as you indicate.

On Sat, Sep 20, 2008 at 11:58 AM, Jamie Lokier [EMAIL PROTECTED] wrote:

 Farrell Aultman wrote:
  The code assumed that when strol is successful, that it will set
  errno to zero.  This is not the case, at least under uClinux.

 It's not the case in general, POSIX doesn't require it to be set to zero.

  The man page does not indicate this either.  What can happen is that
  errno is already set to non-zero before strol is called, then strol
  is successful but since strol doesn't reset errno to zero, the next
  line thinks that strol failed.

 That's right.  The correct way to call strtol in general, if you're
 checking errno after, is to set errno to zero before.

 Since reading errno can be slow (in threaded programs), you might want
 to check if the result from strtol is LONG_MIN or LONG_MAX before
 checking errno.

 -- Jamie



Re: [PATCH] dropbear-051: errno bug fix

2008-09-21 Thread Ming-Ching Tiew
Farrell Aultman wrote:
 Thanks Jamie, I agree with everything you said.  The code would be
 better modified as you indicate.
 

And also I wonder if the maillist accept attachment ? The
patches should be sent as attachment. It will be way too much
work to rework the message content as a patch. Tabs are 
converted to spaces and so on and so forth, it makes 
applying the patch a pain.

Cheers.