This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: include file incompatibilities...


Hi again

It turned out to be easier to fix than i though. Please can you take a
look at this and if you think its OK check it in. Basically, the
FreeBSD stack has its own snprintf which we can use instead of stdio's.


Index: net/common/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/ChangeLog,v
retrieving revision 1.5
diff -u -5 -p -c -r1.5 ChangeLog
cvs server: conflicting specifications of output style
*** net/common/current/ChangeLog        5 Jun 2002 13:16:26 -0000       1.5
--- net/common/current/ChangeLog        7 Jun 2002 17:06:55 -0000
***************
*** 1,5 ****
--- 1,10 ----
+ 2002-06-07  Andrew Lunn  <Andrew.Lunn@ascom.ch>
+ 
+       * src/inet_ntop.c: Fixed FreeBSD stack and stdio incompatibility
+       by not using stdio when using FreeBSD.
+ 
  2002-06-05  Gary Thomas  <gary@chez-thomas.org>
  
        * src/dhcp_prot.c (_dhcp_copy): New function used to better handle
        replies that can be variable length.
  
Index: net/common/current/src/inet_ntop.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/src/inet_ntop.c,v
retrieving revision 1.1
diff -u -5 -p -c -r1.1 inet_ntop.c
cvs server: conflicting specifications of output style
*** net/common/current/src/inet_ntop.c  20 May 2002 22:25:05 -0000      1.1
--- net/common/current/src/inet_ntop.c  7 Jun 2002 17:06:55 -0000
***************
*** 43,53 ****
--- 43,55 ----
  #include <netinet/in.h>
  #include <arpa/inet.h>
  #include <arpa/nameser.h>
  #include <string.h>
  #include <errno.h>
+ #ifndef CYGPKG_NET_FREEBSD_STACK
  #include <stdio.h>
+ #endif
  
  #ifndef IN6ADDRSZ
  #define IN6ADDRSZ    16      /* IPv6 T_AAAA */
  #endif
  #ifndef INT16SZ
*************** inet_ntop4(src, dst, size)
*** 146,156 ****
        size_t size;
  {
        static const char fmt[] = "%u.%u.%u.%u";
        char tmp[sizeof "255.255.255.255"];
  
!       if (sprintf(tmp, fmt, src[0], src[1], src[2], src[3]) > size) {
                errno = ENOSPC;
                return (NULL);
        }
        strcpy(dst, tmp);
        return (dst);
--- 148,158 ----
        size_t size;
  {
        static const char fmt[] = "%u.%u.%u.%u";
        char tmp[sizeof "255.255.255.255"];
  
!       if (snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]) > size) {
                errno = ENOSPC;
                return (NULL);
        }
        strcpy(dst, tmp);
        return (dst);

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]