File 1169-erts-Fix-cport-testcase-on-OS-X.patch of Package erlang

From d7b88f1415b263c1ebc126c420ea555f00211fef Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Fri, 26 Feb 2021 11:04:32 +0100
Subject: [PATCH 4/4] erts: Fix cport testcase on OS X

The compiler complains that there are no prototypes
and refuses to compile the code.
---
 .../test/async_ports_SUITE_data/cport.c       | 52 +++++++++----------
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/erts/emulator/test/async_ports_SUITE_data/cport.c b/erts/emulator/test/async_ports_SUITE_data/cport.c
index 033aff382a..c9efe924f5 100644
--- a/erts/emulator/test/async_ports_SUITE_data/cport.c
+++ b/erts/emulator/test/async_ports_SUITE_data/cport.c
@@ -11,14 +11,28 @@
 
 int read_exact(byte *buf, int len);
 
-int read_cmd(byte *buf)
+int write_exact(byte *buf, int len)
 {
-  int len;
-  if (read_exact(buf, 4) != 4)
-      return(-1);
+  int i, wrote = 0;
+  do {
+    if ((i = write(1, buf+wrote, len-wrote)) < 0)
+      return (i);
+    wrote += i;
+  } while (wrote<len);
+  return len;
+}
 
-  len = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
-  return read_exact(buf, len);
+int read_exact(byte *buf, int len)
+{
+  int i, got=0;
+  do {
+    if ((i = read(0, buf+got, len-got)) <= 0)
+      {
+	return(i);
+      }
+    got += i;
+  } while (got<len);
+  return len;
 }
 
 int write_cmd(byte *buf, int len)
@@ -33,28 +47,14 @@ int write_cmd(byte *buf, int len)
   return write_exact(buf, len);
 }
 
-int read_exact(byte *buf, int len)
+int read_cmd(byte *buf)
 {
-  int i, got=0;
-  do {
-    if ((i = read(0, buf+got, len-got)) <= 0)
-      {
-	return(i);
-      }
-    got += i;
-  } while (got<len);
-  return len;
-}
+  int len;
+  if (read_exact(buf, 4) != 4)
+      return(-1);
 
-int write_exact(byte *buf, int len)
-{
-  int i, wrote = 0;
-  do {
-    if ((i = write(1, buf+wrote, len-wrote)) < 0)
-      return (i);
-    wrote += i;
-  } while (wrote<len);
-  return len;
+  len = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
+  return read_exact(buf, len);
 }
 
 byte static_buf[31457280]; // 30 mb
-- 
2.26.2

openSUSE Build Service is sponsored by