* net.cc (dup_ent): Revert older stupid test for null. Don't copy name if it

is NULL.
This commit is contained in:
Christopher Faylor 2005-03-09 23:46:51 +00:00
parent 7d243cd43b
commit 8b59143fcd
2 changed files with 13 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2005-03-09 Christopher Faylor <cgf@timesys.com>
* net.cc (dup_ent): Revert older stupid test for null. Don't copy name
if it is NULL.
2005-03-09 Corinna Vinschen <corinna@vinschen.de> 2005-03-09 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (fhandler_socket::eid_pipe_name): Fix format * fhandler_socket.cc (fhandler_socket::eid_pipe_name): Fix format

View File

@ -397,8 +397,7 @@ dup_ent (void *old, void *src0, struct_type type)
return NULL; return NULL;
unionent *src = (unionent *) src0; unionent *src = (unionent *) src0;
debug_printf ("duping %sent \"%s\", %p", entnames[type], debug_printf ("duping %sent \"%s\", %p", entnames[type], src->name, src);
src ? src->name : "<null!>", src);
/* Find the size of the raw structure minus any character strings, etc. */ /* Find the size of the raw structure minus any character strings, etc. */
int sz, struct_sz; int sz, struct_sz;
@ -482,11 +481,14 @@ dup_ent (void *old, void *src0, struct_type type)
in each, of course. */ in each, of course. */
dst->port_proto_addrtype = src->port_proto_addrtype; dst->port_proto_addrtype = src->port_proto_addrtype;
char *dp = ((char *) dst) + struct_sz;
if (namelen)
{
/* Copy the name field to dst, using space just beyond the end of /* Copy the name field to dst, using space just beyond the end of
the dst structure. */ the dst structure. */
char *dp = ((char *) dst) + struct_sz;
strcpy (dst->name = dp, src->name); strcpy (dst->name = dp, src->name);
dp += namelen; dp += namelen;
}
/* Copy the 'list' type to dst, using space beyond end of structure /* Copy the 'list' type to dst, using space beyond end of structure
+ storage for name. */ + storage for name. */