aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog6
-rw-r--r--sim/common/dv-sockser.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 3aa491a..2eebba8 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,9 @@
+2010-05-26 Ozkan Sezer <sezeroz@gmail.com>
+
+ * dv-sockser.c (dv_sockser_init): Check error return from socket()
+ call by its equality to -1 not by it being negative.
+ (connected_p): Likewise for accept() call.
+
2010-04-23 Mike Frysinger <vapier@gentoo.org>
* sim-fpu.c (sim_fpu_zero, sim_fpu_qnan): Add 0 initializers.
diff --git a/sim/common/dv-sockser.c b/sim/common/dv-sockser.c
index a8626cd..b09d9c9 100644
--- a/sim/common/dv-sockser.c
+++ b/sim/common/dv-sockser.c
@@ -166,7 +166,7 @@ dv_sockser_init (SIM_DESC sd)
}
sockser_listen_fd = socket (PF_INET, SOCK_STREAM, 0);
- if (sockser_listen_fd < 0)
+ if (sockser_listen_fd == -1)
{
sim_io_eprintf (sd, "sockser init: unable to get socket: %s\n",
strerror (errno));
@@ -274,7 +274,7 @@ connected_p (SIM_DESC sd)
addrlen = sizeof (sockaddr);
sockser_fd = accept (sockser_listen_fd, &sockaddr, &addrlen);
- if (sockser_fd < 0)
+ if (sockser_fd == -1)
return 0;
/* Set non-blocking i/o. */