Skip to content

Commit cb0196f

Browse files
committed
missed an error check
svn path=/trunk/; revision=20282
1 parent 1c2de2b commit cb0196f

File tree

1 file changed

+5
-28
lines changed

1 file changed

+5
-28
lines changed

reactos/apps/utils/net/netstat/netstat.c

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,10 @@
11
/*
2-
* ReactOS Win32 Applications
3-
* Copyright (C) 2005 ReactOS Team
4-
*
5-
* This program is free software; you can redistribute it and/or modify
6-
* it under the terms of the GNU General Public License as published by
7-
* the Free Software Foundation; either version 2 of the License, or
8-
* (at your option) any later version.
9-
*
10-
* This program is distributed in the hope that it will be useful,
11-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
* GNU General Public License for more details.
14-
*
15-
* You should have received a copy of the GNU General Public License
16-
* along with this program; if not, write to the Free Software
17-
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18-
*/
19-
20-
/*
21-
* COPYRIGHT: See COPYING in the top level directory
222
* PROJECT: ReactOS netstat utility
3+
* LICENSE: GPL - See COPYING in the top level directory
234
* FILE: apps/utils/net/netstat/netstat.c
245
* PURPOSE: display IP stack statistics
25-
* PROGRAMMERS: Ged Murphy ([email protected])
26-
* REVISIONS:
27-
* Ged Murphy 19/09/05 Created
28-
* Some ideas/code taken from Rob Dickinson's original app
29-
*
6+
* COPYRIGHT: Copyright 2005 Ged Murphy <[email protected]>
307
*/
31-
328
/*
339
* TODO:
3410
* sort function return values.
@@ -588,14 +564,15 @@ GetIpHostName(BOOL Local, UINT IpAddr, CHAR Name[], int NameLen)
588564
(nIpAddr >> 8) & 0xFF,
589565
(nIpAddr) & 0xFF);
590566
} else {
591-
gethostname(Name, NameLen);
567+
if (gethostname(Name, NameLen) != 0)
568+
DoFormatMessage(WSAGetLastError());
592569
}
593570
} else if (IpAddr == 0x0100007f) {
594571
if (Local) {
595572
if (gethostname(Name, NameLen) != 0)
596573
DoFormatMessage(WSAGetLastError());
597574
} else {
598-
strcpy(Name, "localhost");
575+
_tcsncpy(Name, _T("localhost"), 10);
599576
}
600577
// } else if (phostent = gethostbyaddr((char*)&ipaddr, sizeof(nipaddr), PF_INET)) {
601578
// strcpy(name, phostent->h_name);

0 commit comments

Comments
 (0)