errno = -_rv; \
printf ("\nERROR: " _fn " failed (errno = %d)!\n", -_rv); \
}
-#define stfail(_fn, _rv) \
+#define stabrt(_fmt, _args...) \
+{ \
+ printf ("\nERROR: " _fmt "\n", ##_args); \
+ exit (1); \
+}
+#define stfail(_fn) \
{ \
- errno = -_rv; \
perror ("ERROR when calling " _fn); \
- printf ("\nERROR: " _fn " failed (errno = %d)!\n", -_rv); \
+ printf ("\nERROR: " _fn " failed (errno = %d)!\n", errno); \
exit (1); \
}
((rx_bytes < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))));
if (rx_bytes < 0)
- {
- stfail ("sock_test_read()", -errno);
- }
- else if (stats)
+ stfail ("sock_test_read()");
+
+ if (stats)
stats->rx_bytes += rx_bytes;
return (rx_bytes);
while (tx_bytes != nbytes);
if (tx_bytes < 0)
- {
- stfail ("sock_test_write()", -errno);
- }
- else if (stats)
+ stfail ("sock_test_write()");
+
+ if (stats)
stats->tx_bytes += tx_bytes;
return (tx_bytes);