PERFORCE change 166065 for review
Jonathan Anderson
jona at FreeBSD.org
Tue Jul 14 07:04:18 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=166065
Change 166065 by jona at jona-trustedbsd-belle-vmware on 2009/07/14 07:03:47
Iterate through clients in only ONE place
Affected files ...
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/user_angel/server.c#15 edit
Differences ...
==== //depot/projects/trustedbsd/capabilities/src/tools/cap/user_angel/server.c#15 (text+ko) ====
@@ -293,22 +293,15 @@
if(bytes < 0) return -1;
- for(struct client *client = clients; client; client = client->next)
+ int ret = handle_request(client, req);
+ if(ret)
{
- int ret = handle_request(client, req);
- if(ret)
- {
- int close_connection = (ret < 0);
- client_error(client, "Error handling client request",
- errno, close_connection);
- return ret;
- }
- else return 0;
-
+ int close_connection = (ret < 0);
+ client_error(client, "Error handling client request",
+ errno, close_connection);
+ return ret;
}
-
- fprintf(stderr, "No clients defined\n");
- return -1;
+ else return 0;
}
@@ -328,7 +321,7 @@
else if(!(client->policy_callback(client, req, datum)))
{
errno = EPERM;
- return -1;
+ return 1;
}
int retval;
@@ -438,7 +431,8 @@
}
-void client_error(struct client *client, const char *message, int errnum, int close_connection)
+void client_error(struct client *client, const char *message, int errnum,
+ int close_connection)
{
fprintf(stderr, "%s: %i (%s)\n",
message, errnum, strerror(errnum));
More information about the p4-projects
mailing list