buglwIP - A Lightweight TCP/IP stack - Bugs: bug #39882, No function shall set errno to 0

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #39882: No function shall set errno to 0

Submitted by:  hanhui <hanhui03>
Submitted on:  Wed 28 Aug 2013 04:59:17 AM UTC  
 
Category: sockets/netconnSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: git head

Thu 20 Feb 2014 09:23:56 PM UTC, comment #5:

Done, thanks.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Thu 20 Feb 2014 09:22:42 PM UTC, comment #4:

Updated summary

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Wed 28 Aug 2013 12:30:03 PM UTC, comment #3:

The safer #define for this would be:

#define set_errno(err) do { if (err) { errno = (err); } } while(0)

Bill Auerbach <billauerbach>
Wed 28 Aug 2013 09:09:23 AM UTC, comment #2:

User wants to clear errno must use this code:

errno = 0;

This is a only way to clean errno!

In POSIX system, errno not change while a api execute successful!

so set_errno should be:

#define set_errno(err) { if (err) { errno = (err); } }

A lwip socket call execute successful, errno whill not change.

hanhui <hanhui03>
Wed 28 Aug 2013 07:58:57 AM UTC, comment #1:

Why?

What if the user wants to clear errno?

Mason <mason>
Wed 28 Aug 2013 04:59:17 AM UTC, original submission:

#define set_errno(err) errno = (err)

should be:

#define set_errno(err) { if (err) { errno = (err); } }

hanhui <hanhui03>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by billauerbach (Posted a comment)
  • -unavailable- added by mason (Posted a comment)
  • -unavailable- added by hanhui03 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 20 Feb 2014 09:23:56 PM UTCgoldsimonStatusNone=>Fixed
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed
      SummaryNo function shall set errno to =>No function shall set errno to 0
    Thu 20 Feb 2014 09:22:42 PM UTCgoldsimonSummarysocket errno set error=>No function shall set errno to

    Back to the top


    Powered by Savane 3.1-cleanup1