- if(req.type == REQ_SET_DEBUG) {
- debug_t new_debug_level;
-
- logger(LOG_NOTICE, _("Got '%s' command"), "debug");
- if(req.length != sizeof(req) + sizeof debug_level)
- res.res_errno = EINVAL;
- else {
- memcpy(&new_debug_level, req_data, sizeof(debug_t));
- logger(LOG_NOTICE, _("Changing debug level from %d to %d"),
- debug_level, new_debug_level);
- if(evbuffer_add_printf(res_data,
- _("Changing debug level from %d to %d\n"),
- debug_level, new_debug_level) == -1)
- res.res_errno = errno;
- debug_level = new_debug_level;
+ case REQ_SET_DEBUG: {
+ int new_level;
+ if(sscanf(request, "%*d %*d %d", &new_level) != 1)
+ return false;
+ send_request(c, "%d %d %d", CONTROL, REQ_SET_DEBUG, debug_level);
+ if(new_level >= 0)
+ debug_level = new_level;
+ return true;