Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Jul 1995 17:10:46 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, mpp@mpp.minn.net
Cc:        freebsd-bugs@freebsd.org
Subject:   Re: uname library routine (Was Re: subyte())
Message-ID:  <199507240710.RAA05945@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>After fiddling with the libc uname() routine, I found that
>the version doesn't get returned because it is too big to
>fit into the 32 character string in the version field of the
>utsname structure.  Should the uname libc routine be hacked
>to read the version into a different (larger buffer)
>and then copy just some of that information back into
>the utsname.version field?  Maybe search for the first ":" and
>truncate it there (sort of like what the kernel uname() 
>routine is doing)?

There seems to be a bug in sysctl().  It's supposed to copy
as much data as possible before returning ENOMEM.  uname()
does everything right to take advantage of this, except
possibly something to ensure null termination of the strings.
uname() guarantees null termination but the sysctl() man
page doesn't mention it.  Returning one byte more of real
data and letting the caller zero it is more useful.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199507240710.RAA05945>