summaryrefslogtreecommitdiff
path: root/usr.sbin/mrinfo/mrinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/mrinfo/mrinfo.c')
-rw-r--r--usr.sbin/mrinfo/mrinfo.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/mrinfo/mrinfo.c b/usr.sbin/mrinfo/mrinfo.c
index e8cfc4f091d..692b5250326 100644
--- a/usr.sbin/mrinfo/mrinfo.c
+++ b/usr.sbin/mrinfo/mrinfo.c
@@ -336,12 +336,16 @@ main(argc, argv)
char *host;
int curaddr;
- setlinebuf(stderr);
-
if (geteuid() != 0) {
fprintf(stderr, "mrinfo: must be root\n");
exit(1);
}
+
+ init_igmp();
+ setuid(getuid());
+
+ setlinebuf(stderr);
+
argv++, argc--;
while (argc > 0 && argv[0][0] == '-') {
switch (argv[0][1]) {
@@ -389,8 +393,6 @@ main(argc, argv)
if (debug)
fprintf(stderr, "Debug level %u\n", debug);
- init_igmp();
-
/* Check all addresses; mrouters often have unreachable interfaces */
for (curaddr = 0; hp->h_addr_list[curaddr] != NULL; curaddr++) {
memcpy(&target_addr, hp->h_addr_list[curaddr], hp->h_length);