lwIP | rtemslwip/network_compat: Add gethostname/gethostid (!28)

Kinsey Moore (@opticron) gitlab at rtems.org
Thu Sep 4 21:45:39 UTC 2025




Kinsey Moore commented on a discussion on rtemslwip/common/network_compat.c: https://gitlab.rtems.org/rtems/pkg/rtems-lwip/-/merge_requests/28#note_130043

 > +
 > +int sethostid(long new_hostid)
 > +{
 > +    hostid = new_hostid;
 > +    return 0;
 > +}
 > +
 > +static char hostname[_POSIX_HOST_NAME_MAX] = {0};
 > +
 > +int gethostname(char *name, size_t size)
 > +{
 > +    if (name == NULL) {
 > +        errno = EFAULT;
 > +        return -1;
 > +    }
 > +    strncpy(name, hostname, size);

This now maintains the length of the stored name and avoids use of `str*()` functions. This should resolve all other threads as well.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/pkg/rtems-lwip/-/merge_requests/28#note_130043
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20250904/78b10b5c/attachment-0001.htm>


More information about the bugs mailing list