quark

quark web server
git clone git://git.suckless.org/quark
Log | Files | Refs | LICENSE

commit a9164839e6f091ff66b6684c65d55ed7f5a09ebb
parent ed712285707ecba554d718ef28ec2fd83fb846be
Author: Laslo Hunhold <dev@frign.de>
Date:   Sun, 17 Jan 2021 13:19:45 +0100

Also add a proper warning with a hint when bind() fails

Signed-off-by: Laslo Hunhold <dev@frign.de>

Diffstat:
Msock.c | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sock.c b/sock.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include <arpa/inet.h> +#include <errno.h> #include <fcntl.h> #include <netdb.h> #include <netinet/in.h> @@ -73,7 +74,13 @@ sock_get_ips_arr(const char *host, const char* port, int *sockfd, freeaddrinfo(ai); if (!p) { /* we exhaustet the addrinfo-list and found no connection */ - warn("bind:"); + if (errno == EACCES) { + warn("You need to run as root or have " + "CAP_NET_BIND_SERVICE set to bind to " + "privileged ports"); + } else { + warn("bind:"); + } return 1; }