emulators/hercules4sdl: add patch from upstream for networking crash

Fix issue https://github.com/SDL-Hercules-390/hyperion/issues/525
which can cause a segfault if networking is used.
Created a patch file from an upstream commit, therefore it patches multiple
files. It should be possible to remove it at the next release.
This commit is contained in:
rhialto 2022-12-13 18:41:52 +00:00
parent 657269ec07
commit 2e003a2ff4
3 changed files with 125 additions and 2 deletions

View file

@ -1,6 +1,7 @@
# $NetBSD: Makefile,v 1.9 2022/11/27 15:43:13 rhialto Exp $
# $NetBSD: Makefile,v 1.10 2022/12/13 18:41:52 rhialto Exp $
PKGNAME= hercules4sdl-4.5
PKGREVISION= 1
DISTNAME= hyperion-Release_${PKGVERSION_NOREV}
CATEGORIES= emulators
MASTER_SITES= ${MASTER_SITE_GITHUB:=SDL-Hercules-390/}

View file

@ -1,7 +1,8 @@
$NetBSD: distinfo,v 1.5 2022/11/27 15:43:13 rhialto Exp $
$NetBSD: distinfo,v 1.6 2022/12/13 18:41:52 rhialto Exp $
BLAKE2s (hyperion-Release_4.5.tar.gz) = 2e39391bdfcd789f46e247e74a108fafbab82da8cae6fad4ee6bf8ae13ea5aa1
SHA512 (hyperion-Release_4.5.tar.gz) = 8129bd9129bd8aa1323cf9caa166eabbfe2f9fd2ac93bfc411060ee7d5bd81b1e4f489c816a2ce55a5d4e69f4658d87eae8c534fa5581ef2c951768be43e6be0
Size (hyperion-Release_4.5.tar.gz) = 24271753 bytes
SHA1 (patch-Makefile.am) = 6ae600095ffb29aab2a5e1e467f79a40e814f26d
SHA1 (patch-configure.ac) = 734f64da8f4ce0f790d4eac0f352649d1b6d08f2
SHA1 (patch-issue-525) = 6ec2b5cb760da92ca667bc3f29317bdf770fcbe0

View file

@ -0,0 +1,121 @@
$NetBSD: patch-issue-525,v 1.1 2022/12/13 18:41:52 rhialto Exp $
Cherry-pick from
https://github.com/SDL-Hercules-390/hyperion/commit/2e2e942fb38f43842e8a9e2800aa42c346bfb050.patch
From 2e2e942fb38f43842e8a9e2800aa42c346bfb050 Mon Sep 17 00:00:00 2001
From: Bill Lewis <wrljet@gmail.com>
Date: Sat, 10 Dec 2022 12:15:20 -0500
Subject: [PATCH] Fix for Issue #525
Don't issue messages when setting the CODEPAGE from Hercifc, as they can wind up in the stream, corrupting data exchange with Hercules.
---
codepage.c | 36 ++++++++++++++++++++++++++----------
codepage.h | 1 +
hercifc.c | 2 +-
tuntap.c | 2 +-
4 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/codepage.c b/codepage.c
index 4c3325ad1..7e507e245 100644
--- codepage.c
+++ codepage.c
@@ -1076,7 +1076,10 @@ DLL_EXPORT bool valid_codepage_name( const char* name )
return false;
}
-DLL_EXPORT void set_codepage( const char* name )
+#define SETCODEPAGE_SILENT 1
+#define SETCODEPAGE_VERBOSE 2
+
+static void set_codepage_internal( const char* name, int msgflag )
{
int dflt = FALSE;
@@ -1089,7 +1092,7 @@ DLL_EXPORT void set_codepage( const char* name )
if( strcasecmp(name,"user") == 0 && user_in_use == FALSE )
{
- WRMSG( HHC01477, "W" );
+ if( msgflag == SETCODEPAGE_VERBOSE) WRMSG( HHC01477, "W" );
name = "default";
}
@@ -1100,18 +1103,31 @@ DLL_EXPORT void set_codepage( const char* name )
if( codepage_conv->name && strcasecmp(codepage_conv->name,"user") == 0 && user_in_use == FALSE )
codepage_conv++;
- if(codepage_conv->name)
- {
- if (!dflt)
- WRMSG(HHC01474, "I", "internal", name);
- }
- else
+ if( msgflag == SETCODEPAGE_VERBOSE )
{
- if (!dflt)
- WRMSG (HHC01475, "E", name);
+ if(codepage_conv->name)
+ {
+ if (!dflt)
+ WRMSG(HHC01474, "I", "internal", name);
+ }
+ else
+ {
+ if (!dflt)
+ WRMSG (HHC01475, "E", name);
+ }
}
}
+DLL_EXPORT void set_codepage( const char* name )
+{
+ set_codepage_internal( name, SETCODEPAGE_VERBOSE );
+}
+
+DLL_EXPORT void set_codepage_no_msgs( const char* name )
+{
+ set_codepage_internal( name, SETCODEPAGE_SILENT );
+}
+
DLL_EXPORT int update_codepage(int argc, char *argv[], char *cmd )
{
int rc = 0;
diff --git a/codepage.h b/codepage.h
index 7e4edbc98..a44a58d14 100644
--- codepage.h
+++ codepage.h
@@ -14,6 +14,7 @@
COD_DLL_IMPORT const char* query_codepage();
COD_DLL_IMPORT bool valid_codepage_name( const char* name );
COD_DLL_IMPORT void set_codepage( const char *name);
+COD_DLL_IMPORT void set_codepage_no_msgs( const char* name );
COD_DLL_IMPORT int update_codepage(int argc, char *argv[], char *table );
COD_DLL_IMPORT unsigned char host_to_guest (unsigned char byte);
COD_DLL_IMPORT unsigned char guest_to_host (unsigned char byte);
diff --git a/hercifc.c b/hercifc.c
index d8260d247..1e2ceebc9 100644
--- hercifc.c
+++ hercifc.c
@@ -62,7 +62,7 @@ int main( int argc, char **argv )
sysblk.msglvl = atoi( argv[1] );
if (argv[2])
- set_codepage( argv[2] );
+ set_codepage_no_msgs( argv[2] );
}
// Must not be run from the commandline
diff --git a/tuntap.c b/tuntap.c
index 90708f087..11ddae78a 100644
--- tuntap.c
+++ tuntap.c
@@ -222,7 +222,7 @@ static int TUNTAP_SetMode (int fd, struct hifr *hifr, int iFlags)
// Output:
// pfd Pointer to receive the file descriptor of the
// TUN/TAP interface.
-// pszNetDevName Pointer to receive the name if the interface.
+// pszNetDevName Pointer to receive the name of the interface.
int TUNTAP_CreateInterface( char* pszTUNDevice,
int iFlags,