summaryrefslogtreecommitdiff
path: root/pkg/util-linux/patch/0008-Use-alloca-if-VLAs-aren-t-supported.patch
blob: 73401bb35a9b1904b6d2b2012246532338e3955e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From 7943a7c1c795a1ffe79b2898eb4860cec60dec23 Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Mon, 24 Jun 2019 23:54:21 -0700
Subject: [PATCH] Use alloca if VLAs aren't supported

---
 lib/path.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/path.c b/lib/path.c
index 75fa85305..af90261a6 100644
--- a/lib/path.c
+++ b/lib/path.c
@@ -982,7 +982,11 @@ static int ul_path_cpuparse(struct path_cxt *pc, cpu_set_t **set, int maxcpus, i
 {
 	FILE *f;
 	size_t setsize, len = maxcpus * 7;
+#ifndef __STDC_NO_VLA__
 	char buf[len];
+#else
+	char *buf = alloca(len);
+#endif
 	int rc;
 
 	*set = NULL;
-- 
2.28.0