Check for socket creation success before calling bind().
Reported by: Coverity CID: 1194209
This commit is contained in:
parent
a09a9cbb40
commit
eeb6394364
@ -285,6 +285,16 @@ main(int argc, char *const *argv)
|
||||
err(EX_NOPERM, "setuid() failed");
|
||||
uid = getuid();
|
||||
|
||||
if (ssend < 0) {
|
||||
errno = ssend_errno;
|
||||
err(EX_OSERR, "ssend socket");
|
||||
}
|
||||
|
||||
if (srecv < 0) {
|
||||
errno = srecv_errno;
|
||||
err(EX_OSERR, "srecv socket");
|
||||
}
|
||||
|
||||
alarmtimeout = df = preload = tos = 0;
|
||||
|
||||
outpack = outpackhdr + sizeof(struct ip);
|
||||
@ -625,16 +635,6 @@ main(int argc, char *const *argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ssend < 0) {
|
||||
errno = ssend_errno;
|
||||
err(EX_OSERR, "ssend socket");
|
||||
}
|
||||
|
||||
if (srecv < 0) {
|
||||
errno = srecv_errno;
|
||||
err(EX_OSERR, "srecv socket");
|
||||
}
|
||||
|
||||
if (connect(ssend, (struct sockaddr *)&whereto, sizeof(whereto)) != 0)
|
||||
err(1, "connect");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user