All of lore.kernel.org
 help / color / mirror / Atom feed
From: aq <aquynh@gmail.com>
To: xen-devel <xen-devel@lists.xensource.com>,
	xense-devel@lists.xensource.com,
	Reiner Sailer <sailer@watson.ibm.com>
Subject: [PATCH] policy_tool.c
Date: Tue, 21 Jun 2005 18:22:11 +0900	[thread overview]
Message-ID: <9cde8bff05062102224fed9d3b@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 351 bytes --]

This patch is for policy_tool.c (ChangeSet@1.1727)
- fix few typos.
- handle the possible errors correctly.
- remove the (useless) ouput line "Policy dump End"

Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>

# diffstat policy_tool2.patch 
 policy_tool.c |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: policy_tool2.patch --]
[-- Type: text/x-patch; name="policy_tool2.patch", Size: 1951 bytes --]

===== tools/policy/policy_tool.c 1.1 vs edited =====
--- 1.1/tools/policy/policy_tool.c	2005-06-21 07:28:06 +09:00
+++ edited/tools/policy/policy_tool.c	2005-06-21 18:13:46 +09:00
@@ -14,7 +14,7 @@
  *
  * sHype policy management tool. This code runs in a domain and
  *     manages the Xen security policy by interacting with the
- *     Xen access control module via a /proc/xen/policycmd proc-ioctl, 
+ *     Xen access control module via a /proc/xen/privcmd proc-ioctl, 
  *     which is translated into a policy_op hypercall into Xen.
  * 
  * todo: implement setpolicy to dynamically set a policy cache.
@@ -229,7 +229,6 @@
 	default:
 		printf("UNKNOWN POLICY!\n");
 	}
-	printf("\nPolicy dump End.\n\n");
 }
 
 /*************************** set policy ****************************/
@@ -519,39 +518,35 @@
 int
 main(int argc, char **argv) {
 
-	int policycmd_fd;
+	int policycmd_fd, ret;
 
-	if (argc < 2)
+	if (argc < 2) 
 		usage(argv[0]);
 		
 	if ((policycmd_fd = open("/proc/xen/privcmd", O_RDONLY)) <= 0) {
-		    printf("ERROR: Could not open xen policycmd device!\n");
+		    printf("ERROR: Could not open xen privcmd device!\n");
 		    exit(-1);
 	}
 	    
 	if (!strcmp(argv[1], "setpolicy")) {
 		if (argc != 2)
 			usage(argv[0]);
-		acm_domain_setpolicy(policycmd_fd);
-
+		ret = acm_domain_setpolicy(policycmd_fd);
 	} else if (!strcmp(argv[1], "getpolicy")) {
 		if (argc != 2)
 			usage(argv[0]);
-		acm_domain_getpolicy(policycmd_fd);
-
+		ret = acm_domain_getpolicy(policycmd_fd);
 	} else if (!strcmp(argv[1], "loadpolicy")) {
 		if (argc != 3) 
 			usage(argv[0]);
-		acm_domain_loadpolicy(policycmd_fd, argv[2]);
-
+		ret = acm_domain_loadpolicy(policycmd_fd, argv[2]);
 	} else if (!strcmp(argv[1], "dumpstats")) {
 		if (argc != 2) 
 			usage(argv[0]);
-		acm_domain_dumpstats(policycmd_fd);
-
+		ret = acm_domain_dumpstats(policycmd_fd);
 	} else
 		usage(argv[0]);
 
 	close(policycmd_fd);
-	return 0;
+	return ret;
 }

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

                 reply	other threads:[~2005-06-21  9:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9cde8bff05062102224fed9d3b@mail.gmail.com \
    --to=aquynh@gmail.com \
    --cc=sailer@watson.ibm.com \
    --cc=xen-devel@lists.xensource.com \
    --cc=xense-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.