Revision: 68978
http://sourceforge.net/p/brlcad/code/68978
Author: brlcad
Date: 2016-10-04 12:12:16 +0000 (Tue, 04 Oct 2016)
Log Message:
-----------
more places we need to initialize errno before we test it.
Modified Paths:
--------------
brlcad/trunk/src/libged/gqa.c
brlcad/trunk/src/libpkg/pkg.c
brlcad/trunk/src/util/ttcp.c
Modified: brlcad/trunk/src/libged/gqa.c
===================================================================
--- brlcad/trunk/src/libged/gqa.c 2016-10-04 06:35:07 UTC (rev 68977)
+++ brlcad/trunk/src/libged/gqa.c 2016-10-04 12:12:16 UTC (rev 68978)
@@ -670,6 +670,7 @@
break;
case 'U':
+ errno = 0;
use_air = strtol(bu_optarg, (char **)NULL, 10);
if (errno == ERANGE || errno == EINVAL) {
bu_vls_printf(_ged_current_gedp->ged_result_str, "error in
air argument %s\n", bu_optarg);
Modified: brlcad/trunk/src/libpkg/pkg.c
===================================================================
--- brlcad/trunk/src/libpkg/pkg.c 2016-10-04 06:35:07 UTC (rev 68977)
+++ brlcad/trunk/src/libpkg/pkg.c 2016-10-04 12:12:16 UTC (rev 68978)
@@ -762,6 +762,7 @@
#endif
do {
+ errno = 0;
#ifdef HAVE_WINSOCK_H
s2 = accept(fd, (struct sockaddr *)NULL, NULL);
#else
@@ -897,6 +898,7 @@
else
tv.tv_usec = 20000; /* 20 ms */
+ errno = 0;
FD_ZERO(&bits);
FD_SET(pc->pkc_fd, &bits);
i = select(pc->pkc_fd+1, &bits, (fd_set *)0, (fd_set *)0, &tv);
@@ -1010,6 +1012,7 @@
if (len > 0)
memcpy(tbuf+sizeof(hdr), buf, len);
+ errno = 0;
i = PKG_SEND(pc->pkc_fd, tbuf, len+sizeof(hdr));
if ((size_t)i != len+sizeof(hdr)) {
if (i < 0) {
@@ -1026,6 +1029,7 @@
return (int)len;
}
/* Send them separately */
+ errno = 0;
if ((i = PKG_SEND(pc->pkc_fd, (char *)&hdr, sizeof(hdr))) != sizeof(hdr)) {
if (i < 0) {
if (errno == EBADF)
@@ -1040,6 +1044,7 @@
}
if (len <= 0)
return 0;
+ errno = 0;
i = PKG_SEND(pc->pkc_fd, buf, len);
if ((size_t)i != len) {
if (i < 0) {
@@ -1134,6 +1139,7 @@
memcpy(tbuf+sizeof(hdr), buf1, len1);
if (len2 > 0)
memcpy(tbuf+sizeof(hdr)+len1, buf2, len2);
+ errno = 0;
i = PKG_SEND(pc->pkc_fd, tbuf, len1+len2+sizeof(hdr));
if ((size_t)i != len1+len2+sizeof(hdr)) {
if (i < 0) {
@@ -1150,7 +1156,9 @@
return (int)(len1+len2);
}
/* Send it in three pieces */
- if ((i = (ssize_t)PKG_SEND(pc->pkc_fd, (char *)&hdr, sizeof(hdr))) !=
sizeof(hdr)) {
+ errno = 0;
+ i = (ssize_t)PKG_SEND(pc->pkc_fd, (char *)&hdr, sizeof(hdr));
+ if (i != sizeof(hdr)) {
if (i < 0) {
if (errno == EBADF)
return -1;
@@ -1166,6 +1174,7 @@
return -1; /* amount of user data sent */
}
+ errno = 0;
i = PKG_SEND(pc->pkc_fd, buf1, len1);
if ((size_t)i != len1) {
if (i < 0) {
@@ -1185,6 +1194,7 @@
if (len2 <= (size_t)0)
return i;
+ errno = 0;
i = PKG_SEND(pc->pkc_fd, buf2, len2);
if (i != (ssize_t)len2) {
if (i < 0) {
@@ -1257,6 +1267,7 @@
return 0;
}
+ errno = 0;
i = write(pc->pkc_fd, pc->pkc_stream, (size_t)pc->pkc_strpos);
if (i != pc->pkc_strpos) {
if (i < 0) {
Modified: brlcad/trunk/src/util/ttcp.c
===================================================================
--- brlcad/trunk/src/util/ttcp.c 2016-10-04 06:35:07 UTC (rev 68977)
+++ brlcad/trunk/src/util/ttcp.c 2016-10-04 12:12:16 UTC (rev 68978)
@@ -451,6 +451,7 @@
Nwrite(int fd, char *buf, int count)
{
int cnt;
+ errno = 0;
if (udp) {
again:
cnt = sendto(fd, (const void *)buf, (size_t) count, 0,
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits