| 4753 | } |
| 4754 | |
| 4755 | void rejectCommandFormat(client *c, const char *fmt, ...) { |
| 4756 | if (c->cmd) c->cmd->rejected_calls++; |
| 4757 | flagTransaction(c); |
| 4758 | va_list ap; |
| 4759 | va_start(ap,fmt); |
| 4760 | sds s = sdscatvprintf(sdsempty(),fmt,ap); |
| 4761 | va_end(ap); |
| 4762 | /* Make sure there are no newlines in the string, otherwise invalid protocol |
| 4763 | * is emitted (The args come from the user, they may contain any character). */ |
| 4764 | sdsmapchars(s, "\r\n", " ", 2); |
| 4765 | if (c->cmd && c->cmd->proc == execCommand) { |
| 4766 | execCommandAbort(c, s); |
| 4767 | sdsfree(s); |
| 4768 | } else { |
| 4769 | /* The following frees 's'. */ |
| 4770 | addReplyErrorSds(c, s); |
| 4771 | } |
| 4772 | } |
| 4773 | |
| 4774 | /* Returns 1 for commands that may have key names in their arguments, but have |
| 4775 | * no pre-determined key positions. */ |
no test coverage detected