Author: gnn
Date: Tue May  3 16:00:36 2011
New Revision: 221391
URL: http://svn.freebsd.org/changeset/base/221391

Log:
  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

Modified:
  head/tools/tools/vxge/vxge_info.c

Modified: head/tools/tools/vxge/vxge_info.c
==============================================================================
--- head/tools/tools/vxge/vxge_info.c   Tue May  3 16:00:26 2011        
(r221390)
+++ head/tools/tools/vxge/vxge_info.c   Tue May  3 16:00:36 2011        
(r221391)
@@ -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) ||
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to