]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
command: Make struct command_context->cmd_ptr const.
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 5 Jan 2015 03:28:58 +0000 (03:28 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 1 Apr 2015 13:30:47 +0000 (13:30 +0000)
The fields of struct server command never need to be modified so they
can be const.

command.c
command.h

index 2ef9c5a87b54760ed38fc41e4f3b83391a4aa3f5..cb5cce16103f891e709dccce1dc39262d5ec0f84 100644 (file)
--- a/command.c
+++ b/command.c
@@ -780,7 +780,7 @@ static int com_tasks(struct command_context *cc)
  * check if perms are sufficient to exec a command having perms cmd_perms.
  * Returns 0 if perms are sufficient, -E_PERM otherwise.
  */
  * check if perms are sufficient to exec a command having perms cmd_perms.
  * Returns 0 if perms are sufficient, -E_PERM otherwise.
  */
-static int check_perms(unsigned int perms, struct server_command *cmd_ptr)
+static int check_perms(unsigned int perms, const struct server_command *cmd_ptr)
 {
        PARA_DEBUG_LOG("checking permissions\n");
        return (cmd_ptr->perms & perms) < cmd_ptr->perms ? -E_PERM : 0;
 {
        PARA_DEBUG_LOG("checking permissions\n");
        return (cmd_ptr->perms & perms) < cmd_ptr->perms ? -E_PERM : 0;
index 6d2202071c6b849fe37a9a69c30c21d09ff80ef0..d28db0389f01846d4b7bb0c9c37ff156028a2bbf 100644 (file)
--- a/command.h
+++ b/command.h
@@ -11,7 +11,7 @@ struct command_context {
        /** Argument vector. */
        char **argv;
        /** The command being executed. */
        /** Argument vector. */
        char **argv;
        /** The command being executed. */
-       struct server_command *cmd;
+       const struct server_command *cmd;
        /** File descriptor and crypto keys. */
        struct stream_cipher_context scc;
 };
        /** File descriptor and crypto keys. */
        struct stream_cipher_context scc;
 };