diff options
author | gnn <gnn@FreeBSD.org> | 2011-05-03 16:00:36 +0000 |
---|---|---|
committer | gnn <gnn@FreeBSD.org> | 2011-05-03 16:00:36 +0000 |
commit | 896f8696ac7d9a2b191787641d38afa300a4f490 (patch) | |
tree | 27350115037c3619ed54cbc4d5786fa1af6b2efb /tools | |
parent | e43878f43c377ac289869d75122d0fb5cdf27114 (diff) | |
download | FreeBSD-src-896f8696ac7d9a2b191787641d38afa300a4f490.zip FreeBSD-src-896f8696ac7d9a2b191787641d38afa300a4f490.tar.gz |
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
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools/vxge/vxge_info.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/tools/vxge/vxge_info.c b/tools/tools/vxge/vxge_info.c index 6a56137..d213d87 100644 --- a/tools/tools/vxge/vxge_info.c +++ b/tools/tools/vxge/vxge_info.c @@ -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) || |