Clash in sethostname char const argument

Pavel Pisa ppisa4lists at pikron.com
Fri Oct 31 01:04:52 UTC 2014


Hello Sebastian,

I am starting to test GCC-4.9.2 toolchain with actual RTEMS
and I have noticed that when I use actual Newlib GIT
there is added

#if __BSD_VISIBLE || (defined(_XOPEN_SOURCE) && __XSI_VISIBLE < 500)
int	_EXFUN(sethostname, (const char *, size_t));
#endif

to include/sys/unistd.h

but RTEMS declares these without const which results
in rtems cpukit build error. Please, commit correction
in type to RTEMS.

Best wishes,

               Pavel


diff --git a/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h b/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h
index 567cc8a..865b644 100644
--- a/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h
+++ b/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h
@@ -188,7 +188,7 @@ extern char *rtems_bsdnet_domain_name;
 /*
  * Some extra prototypes
  */
-int sethostname (char *name, size_t namelen);
+int sethostname (const char *name, size_t namelen);
 void domaininit (void *);
 void ifinit (void *);
 void ipintr (void);
diff --git a/cpukit/libnetworking/rtems/sghostname.c b/cpukit/libnetworking/rtems/sghostname.c
index 6935b5c..8ac5c58 100644
--- a/cpukit/libnetworking/rtems/sghostname.c
+++ b/cpukit/libnetworking/rtems/sghostname.c
@@ -28,7 +28,7 @@ gethostname (char *name, size_t namelen)
 }

 int
-sethostname (char *name, size_t namelen)
+sethostname (const char *name, size_t namelen)
 {
        char *old, *new;



More information about the devel mailing list