| 3924 | } |
| 3925 | |
| 3926 | void rejectCommandFormat(client *c, const char *fmt, ...) { |
| 3927 | if (c->cmd) c->cmd->rejected_calls++; |
| 3928 | flagTransaction(c); |
| 3929 | va_list ap; |
| 3930 | va_start(ap,fmt); |
| 3931 | sds s = sdscatvprintf(sdsempty(),fmt,ap); |
| 3932 | va_end(ap); |
| 3933 | /* Make sure there are no newlines in the string, otherwise invalid protocol |
| 3934 | * is emitted (The args come from the user, they may contain any character). */ |
| 3935 | sdsmapchars(s, "\r\n", " ", 2); |
| 3936 | if (c->cmd && c->cmd->proc == execCommand) { |
| 3937 | execCommandAbort(c, s); |
| 3938 | sdsfree(s); |
| 3939 | } else { |
| 3940 | /* The following frees 's'. */ |
| 3941 | addReplyErrorSds(c, s); |
| 3942 | } |
| 3943 | } |
| 3944 | |
| 3945 | /* Returns 1 for commands that may have key names in their arguments, but have |
| 3946 | * no pre-determined key positions. */ |
no test coverage detected