Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 May 2011 16:00:37 +0000 (UTC)
From:      "George V. Neville-Neil" <gnn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r221391 - head/tools/tools/vxge
Message-ID:  <201105031600.p43G0bhZ001159@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) ||



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105031600.p43G0bhZ001159>