[Hostname-devel] hostname -s behaviour should be consistent with other unixes (and with documentation)

Jiri Popelka jpopelka at redhat.com
Mon Nov 2 08:33:45 UTC 2009


Yes, my patch was against version 2.95.
Sorry for not checking the newest version before making
the patch (or at least getting you know for which version it is).

Jiri

On 10/27/2009 01:07 PM, Michael Meskes wrote:
> Just a short comment on the patch.
>
> On Wed, Oct 21, 2009 at 05:39:35AM -0400, Jiri Popelka wrote:
>    
>> diff -up hostname/hostname.c.hostnameshort hostname/hostname.c
>> --- hostname/hostname.c.hostnameshort	2007-12-27 12:45:12.000000000 +0100
>> +++ hostname/hostname.c	2009-10-21 11:19:46.000000000 +0200
>> @@ -83,11 +83,12 @@ localdomain()
>>    * If something goes wrong, 0 is returned, and errno set.
>>    */
>>   char *
>> -localhost()
>> +localhost(enum type_t type)
>>   {
>>   	char *buf = 0;
>>   	size_t buf_len = 0;
>>   	int myerror = 0;
>> +	char *p;
>>
>>   	do {
>>   		errno = 0;
>> @@ -108,6 +109,11 @@ localhost()
>>   	if (myerror)
>>   		err(1, NULL);
>>
>> +	if (type == SHORT) {
>> +		if (p = strchr(buf, '.'))
>> +			*p = '\0';
>> +	}
>> +	
>>   	return buf;
>>   }
>>
>>      
> Either your version is different from ours or this whole part is not needed. We
> have this code snippet right in front of your patch:
>
> 	/*
>           * a hostname must not contain a dot, so if we find one,
>           * we also have a domain in here, which we better remove
>           */
>          *(strchrnul(buf, '.')) = '\0';
>
> Michael
>
>    




More information about the Hostname-devel mailing list