From owner-svn-src-head@FreeBSD.ORG Tue May 3 16:00:37 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BD6310656F2; Tue, 3 May 2011 16:00:37 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3940F8FC19; Tue, 3 May 2011 16:00:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p43G0bxe001161; Tue, 3 May 2011 16:00:37 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p43G0bhZ001159; Tue, 3 May 2011 16:00:37 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201105031600.p43G0bhZ001159@svn.freebsd.org> From: "George V. Neville-Neil" Date: Tue, 3 May 2011 16:00:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221391 - head/tools/tools/vxge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2011 16:00:37 -0000 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 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) ||