duplicating client structure.

Andrea G. Forte andreaf at cs.columbia.edu
Thu Sep 2 22:10:28 UTC 2004


Hi all,

I am brand new list member, and I hope I can get a LOT of help from you
guys.;)
Right now I am modifying the dhclient.c and I need to make a local copy of
the memory pointed by *client and *picked, including all the sub-pointers
nested in the client_lease and client_state structures. How can I make an
exact copy of that memory without having to allocate memory for each
single pointer included in the structure? Is there a way? How is this
memory allocated in the first place?
I need to do this because I need to make a local copy of the data.
Unfortunately with a normal memcpy I only copy some data and lots of
pointers, which means that if the data is changed, my pointers will also
point to the new data loosing the old value.
Hope you guys can help me.

Thanks a lot.

--
Andrea G. Forte

http://www.cs.columbia.edu/~andreaf



More information about the dhcp-hackers mailing list