Use different port if running without privileges
This commit is contained in:
parent
aa8afceb84
commit
bfc0028755
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* discard
|
* discard
|
||||||
* Written in 2020 by Lucas
|
* Written in 2020-2021 by Lucas
|
||||||
* CC0 1.0 Universal/Public domain - No rights reserved
|
* CC0 1.0 Universal/Public domain - No rights reserved
|
||||||
*
|
*
|
||||||
* To the extent possible under law, the author(s) have dedicated all
|
* To the extent possible under law, the author(s) have dedicated all
|
||||||
@ -26,6 +26,7 @@ usage(void)
|
|||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
const char *port = NULL;
|
||||||
int ch, do_tcp, do_udp;
|
int ch, do_tcp, do_udp;
|
||||||
|
|
||||||
do_tcp = do_udp = 0;
|
do_tcp = do_udp = 0;
|
||||||
@ -44,6 +45,8 @@ main(int argc, char *argv[])
|
|||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
|
port = geteuid() == 0 ? "discard" : "9999";
|
||||||
|
|
||||||
if (argc > 0)
|
if (argc > 0)
|
||||||
usage();
|
usage();
|
||||||
if (!do_tcp && !do_udp)
|
if (!do_tcp && !do_udp)
|
||||||
|
Loading…
Reference in New Issue
Block a user