Skip to content

Commit ea21398

Browse files
committed
common/common.c: minimize_formatting_string(): do not loudly log complaints about known cosmetic formatting chars [#2450]
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
1 parent 3a62a83 commit ea21398

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

common/common.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2911,6 +2911,32 @@ char * minimize_formatting_string(char *buf, size_t buflen, const char *fmt, int
29112911
*b++ = *p;
29122912
i++;
29132913
continue;
2914+
2915+
/* Non-functional characters as far as vararg
2916+
* stack size is concerned: always-signed,
2917+
* left/right alignment, padding, minimal width,
2918+
* floating-point precision (note: asterisk is
2919+
* special, not skipped - handled above)... */
2920+
case '+':
2921+
case '-':
2922+
case '.':
2923+
case '0':
2924+
case '1':
2925+
case '2':
2926+
case '3':
2927+
case '4':
2928+
case '5':
2929+
case '6':
2930+
case '7':
2931+
case '8':
2932+
case '9':
2933+
/* Skip as irrelevant to memory access;
2934+
* log just in case of deep troubleshooting,
2935+
* but do not be noisy.
2936+
*/
2937+
upsdebugx(6, "%s: in-escape: assuming a cosmetic formatting char: '%c'", __func__, *p);
2938+
break;
2939+
29142940
default:
29152941
upsdebugx(1, "%s: in-escape: unexpected formatting char: '%c'", __func__, *p);
29162942
}

0 commit comments

Comments
 (0)