fix: error message

This commit is contained in:
lohhiiccc 2026-03-23 10:02:25 -05:00
parent 297d38bff1
commit f9b84f709c

View file

@ -1,5 +1,7 @@
#include <string.h> #include <string.h>
#include <stdio.h>
#include "version_gen.h"
#include "ping/ft_ping_flags.h" #include "ping/ft_ping_flags.h"
#include "internal/ping/output.h" #include "internal/ping/output.h"
#include "internal/ping/scheduler.h" #include "internal/ping/scheduler.h"
@ -26,7 +28,11 @@ ping_run(const struct ping_config *config)
return 1; return 1;
handle = icmp_create(); handle = icmp_create();
if (NULL == handle) if (NULL == handle)
{
dprintf(STDERR_FILENO, "%s: requires CAP_NET_RAW or root privileges\n",
g_prog_name.name);
return 1; return 1;
}
if (HAS_FLAG(config->flags, FLAG_DONT_FRAGMENT) if (HAS_FLAG(config->flags, FLAG_DONT_FRAGMENT)
&& 0 != icmp_set_dont_fragment(handle)) && 0 != icmp_set_dont_fragment(handle))
{ {