user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 4/4] xap_helper.h: add missing headers and avoid reallocarray
  2023-09-24 21:08  6% [PATCH 0/4] various CentOS 7.x related fixes Eric Wong
@ 2023-09-24 21:08  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-09-24 21:08 UTC (permalink / raw)
  To: meta

These changes are necessary with glibc 2.17 and g++ 4.8.5
on CentOS 7.x.  We don't have to worry about overflow with
realloc(3) here since WORKER_MAX is only USHRT_MAX and
sizeof(pid_t) is 4 bytes on every platform I've encountered.
---
 lib/PublicInbox/xap_helper.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/xap_helper.h b/lib/PublicInbox/xap_helper.h
index 377ff45a..5f04316c 100644
--- a/lib/PublicInbox/xap_helper.h
+++ b/lib/PublicInbox/xap_helper.h
@@ -35,7 +35,10 @@
 #include <limits.h>
 #include <search.h>
 #include <signal.h>
+#include <stddef.h>
+#include <stdint.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <sysexits.h>
 #include <unistd.h>
@@ -1084,9 +1087,9 @@ static void do_sigttin(void)
 		warnx("workers cannot exceed %zu", (size_t)WORKER_MAX);
 		return;
 	}
-	void *p = reallocarray(worker_pids, nworker + 1, sizeof(pid_t));
+	void *p = realloc(worker_pids, (nworker + 1) * sizeof(pid_t));
 	if (!p) {
-		warn("reallocarray");
+		warn("realloc worker_pids");
 	} else {
 		worker_pids = (pid_t *)p;
 		worker_pids[nworker++] = 0;

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/4] various CentOS 7.x related fixes
@ 2023-09-24 21:08  6% Eric Wong
  2023-09-24 21:08  7% ` [PATCH 4/4] xap_helper.h: add missing headers and avoid reallocarray Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-09-24 21:08 UTC (permalink / raw)
  To: meta

Still not sure how to best handle 3rd-party repos from
install/deps...

Eric Wong (4):
  test_common: force IPv4 with pre-IPv6 Net::POP3
  install/deps: fix RPM installation of some packages
  lei: use scalar %SIG assignment
  xap_helper.h: add missing headers and avoid reallocarray

 install/deps.perl             | 8 ++++++--
 lib/PublicInbox/LEI.pm        | 6 +++---
 lib/PublicInbox/TestCommon.pm | 1 +
 lib/PublicInbox/xap_helper.h  | 7 +++++--
 t/pop3d-limit.t               | 2 +-
 5 files changed, 16 insertions(+), 8 deletions(-)

^ permalink raw reply	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-09-24 21:08  6% [PATCH 0/4] various CentOS 7.x related fixes Eric Wong
2023-09-24 21:08  7% ` [PATCH 4/4] xap_helper.h: add missing headers and avoid reallocarray Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).