Rewrite a string option. */
| 1551 | |
| 1552 | /* Rewrite a string option. */ |
| 1553 | void rewriteConfigStringOption(struct rewriteConfigState *state, const char *option, const char *value, const char *defvalue) { |
| 1554 | int force = 1; |
| 1555 | sds line; |
| 1556 | |
| 1557 | /* String options set to NULL need to be not present at all in the |
| 1558 | * configuration file to be set to NULL again at the next reboot. */ |
| 1559 | if (value == NULL) { |
| 1560 | rewriteConfigMarkAsProcessed(state,option); |
| 1561 | return; |
| 1562 | } |
| 1563 | |
| 1564 | /* Set force to zero if the value is set to its default. */ |
| 1565 | if (defvalue && strcmp(value,defvalue) == 0) force = 0; |
| 1566 | |
| 1567 | line = sdsnew(option); |
| 1568 | line = sdscatlen(line, " ", 1); |
| 1569 | line = sdscatrepr(line, value, strlen(value)); |
| 1570 | |
| 1571 | rewriteConfigRewriteLine(state,option,line,force); |
| 1572 | } |
| 1573 | |
| 1574 | /* Rewrite a SDS string option. */ |
| 1575 | void rewriteConfigSdsOption(struct rewriteConfigState *state, const char *option, sds value, const sds defvalue) { |
no test coverage detected