Give some sort of message when the program is not run as root.

Root privileges are required to talk to the device.

Submitted by:	Sriram Rapuru at Wipro for Exar Inc.
MFC after:	2 weeks
This commit is contained in:
gnn 2011-05-03 16:00:36 +00:00
parent e43878f43c
commit 896f8696ac

View File

@ -31,6 +31,7 @@
/*$FreeBSD$*/
#include "vxge_info.h"
#include <unistd.h>
static int sockfd;
static struct ifreq ifr;
@ -38,6 +39,15 @@ static struct ifreq ifr;
int
main(int argc, char *argv[])
{
uid_t uid;
uid = getuid();
if (uid) {
printf("vxge-manage: Operation not permitted.\nExiting...\n");
goto _exit0;
}
if (argc >= 4) {
if (!((strcasecmp(argv[2], "regs") == 0) ||
(strcasecmp(argv[2], "stats") == 0) ||