Improve bind failure message to indicate the port that failed

Originally committed as revision 1399 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Philip Gladstone 2003-01-05 23:09:01 +00:00
parent 3178ee4cc4
commit b17d099db4

View File

@ -429,7 +429,9 @@ static int socket_open_listen(struct sockaddr_in *my_addr)
setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp)); setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp));
if (bind (server_fd, (struct sockaddr *) my_addr, sizeof (*my_addr)) < 0) { if (bind (server_fd, (struct sockaddr *) my_addr, sizeof (*my_addr)) < 0) {
perror ("bind"); char bindmsg[32];
snprintf(bindmsg, sizeof(bindmsg), "bind(port %d)", ntohs(my_addr->sin_port));
perror (bindmsg);
close(server_fd); close(server_fd);
return -1; return -1;
} }