[EMAIL PROTECTED] writes:

> when I set a pointer to the structure, and say, get the OS version:

What do you mean by "set a pointer"?

Are you actually allocating a "struct utsname" or merely a pointer to
one?

> struct utsname *host_uname;

Only a pointer?  Don't do that!  You must allocate an actual struct
and pass a pointer to that to uname().

> os_version = malloc(strlen(host_uname->release));
> os_version = (host_uname->release);
             ^
No! No! No!  Use strcpy().
(but if you had allocated a struct like you should have done in the
first place, you wouldn't even have to do a copy)

--kevin
-- 
Kevin D. Clark (CetaceanNetworks.com!kclark)  |
Cetacean Networks, Inc.                       |   Give me a decent UNIX
Portsmouth, N.H. (USA)                        |  and I can move the world
alumni.unh.edu!kdc (PGP Key Available)        |








**********************************************************
To unsubscribe from this list, send mail to
[EMAIL PROTECTED] with the following text in the
*body* (*not* the subject line) of the letter:
unsubscribe gnhlug
**********************************************************

Reply via email to