script: avoid gcc -Wstringop-overread for strnlen

This commit is contained in:
Nigel Tao
2024-07-27 09:33:39 +10:00
parent ce1f59e9ce
commit a7fb1e8d69
2 changed files with 2 additions and 2 deletions

View File

@@ -418,7 +418,7 @@ compute_exit_code(const char* status_msg) {
size_t n = strnlen(status_msg, 2047);
if (n >= 2047) {
status_msg = "main: internal error: error message is too long";
n = strnlen(status_msg, 2047);
n = strlen(status_msg);
}
fprintf(stderr, "%s\n", status_msg);
// Return an exit code of 1 for regular (foreseen) errors, e.g. badly

View File

@@ -307,7 +307,7 @@ compute_exit_code(const char* status_msg) {
size_t n = strnlen(status_msg, 2047);
if (n >= 2047) {
status_msg = "main: internal error: error message is too long";
n = strnlen(status_msg, 2047);
n = strlen(status_msg);
}
fprintf(stderr, "%s\n", status_msg);
// Return an exit code of 1 for regular (foreseen) errors, e.g. badly