buglwIP - A Lightweight TCP/IP stack - Bugs: bug #55034, apps/smtp.c fails to compile with...

 
 

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

bug #55034: apps/smtp.c fails to compile with strict C compatibility because of strnlen

Submitter:  Niklas Gürtler <erlkoenig>
Submitted:  Fri 16 Nov 2018 11:28:25 AM UTC
   
 
Category:  apps Severity:  3 - Normal
Item Group:  Compiler Warning Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned Release:  None
lwIP version:  2.1.1

Mon 19 Nov 2018 01:44:00 PM UTC, comment #1: 

Fixed, thanks for reporting!

Dirk Ziegelmeier <dziegel>
Group administrator
Fri 16 Nov 2018 11:28:25 AM UTC, original submission:  

Dear lwIP maintainers,

the apps/smtp.c file fails to compile if the compiler is configured to strictly observe the C standard (e.g. -std=c11 for GCC), because strnlen is a POSIX function but not defined by the C standard. Simply setting -std=gnu11 does not work with e.g. newlib, because this results in some system header #defining BYTE_ORDER, which then conflicts with the BYTE_ORDER from arch.h.

I think the best solution is to either avoid strnlen, or add a "#define _POSIX_C_SOURCE 200809L" to the top of smtp.h (before all #include's) to enable strnlen for C libraries that support it (including newlib).

Thanks & greetings,
Niklas

Niklas Gürtler <erlkoenig>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #45443:  patch-strnlen-posix.txt added by erlkoenig (281B - text/plain - Patch to add _POSIX_C_SOURCE macro to smtp.c)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dziegel (Posted a comment)
  • -email is unavailable- added by erlkoenig (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-11-19 dziegel StatusNone Fixed
        Open/ClosedOpen Closed
    2018-11-16 erlkoenig Attached File- Added patch-strnlen-posix.txt, #45443

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code