TB: Why does PR_GetSystemInfo/PR_SI_HOSTNAME truncate the hostname?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

TB: Why does PR_GetSystemInfo/PR_SI_HOSTNAME truncate the hostname?

Philip Prindeville
I was looking at PR_GetSystemInfo(), and the loop in it:

136        case PR_SI_HOSTNAME:
137          if (PR_FAILURE == _PR_MD_GETHOSTNAME(buf, (PRUintn)buflen))
138              return PR_FAILURE;
139           /*
140            * On some platforms a system does not have a hostname and
141            * its IP address is returned instead.   The following code
142            * should be skipped on those platforms.
143            */
144  #ifndef _PR_GET_HOST_ADDR_AS_NAME
145           /* Return the unqualified hostname */
146           while (buf [len] && (len < buflen)) {
147               if (buf[len] == /'.'/) {
148                   buf[len] = /'\0'/;
149                   break;
150               }
151               len  += 1;
152           }
153  #endif
154           break;


And I can't figure out why it would want to truncate the return value
if it contains '.'?

What would break if the code in the #ifndef/#endif were removed?

-Philip



_______________________________________________
mozilla-general mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-general