From: Andre Noll Date: Mon, 5 Jan 2015 03:28:58 +0000 (+0000) Subject: command: Make struct command_context->cmd_ptr const. X-Git-Tag: v0.5.5~51 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=38de4128737b8d86c637d5d0edc7cffd74666bdc;p=paraslash.git command: Make struct command_context->cmd_ptr const. The fields of struct server command never need to be modified so they can be const. --- diff --git a/command.c b/command.c index 2ef9c5a8..cb5cce16 100644 --- 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. */ -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; diff --git a/command.h b/command.h index 6d220207..d28db038 100644 --- a/command.h +++ b/command.h @@ -11,7 +11,7 @@ struct command_context { /** 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; };