X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=sim%2Fcommon%2Fdv-sockser.c;h=34d17fd2b41bfb9c23fc4bc100a5cd676512ec87;hb=9b254dd1ce46c19dde1dde5b8d1e22e862dfacce;hp=fb457d4f0b0dcd3286159c0ed4960c9101227b82;hpb=72ec28b8afa357cdde70c612b4e0e9f37a34f8e4;p=deliverable%2Fbinutils-gdb.git diff --git a/sim/common/dv-sockser.c b/sim/common/dv-sockser.c index fb457d4f0b..34d17fd2b4 100644 --- a/sim/common/dv-sockser.c +++ b/sim/common/dv-sockser.c @@ -1,20 +1,19 @@ /* Serial port emulation using sockets. - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998, 2007, 2008 Free Software Foundation, Inc. Contributed by Cygnus Solutions. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +You should have received a copy of the GNU General Public License +along with this program. If not, see . */ /* FIXME: will obviously need to evolve. - connectionless sockets might be more appropriate. */ @@ -74,7 +73,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #endif /* ! defined (FNBLOCK) */ #endif /* ! defined (O_NONBLOCK) */ -#define MIN(a,b) ((a) < (b) ? (a) : (b)) /* Compromise between eating cpu and properly busy-waiting. One could have an option to set this but for now that seems @@ -148,7 +146,9 @@ dv_sockser_init (SIM_DESC sd) sockser_addr); return SIM_RC_FAIL; } - tmp = MIN (port_str - sockser_addr, (int) sizeof hostname - 1); + tmp = port_str - sockser_addr; + if (tmp >= sizeof hostname) + tmp = sizeof (hostname) - 1; strncpy (hostname, sockser_addr, tmp); hostname[tmp] = '\000'; port = atoi (port_str + 1);