C compatibility fixes

The tigervnc-xserver120.patch change is already upstream
(commit e4ec992984983ac9107efae1f1cc552007e4229e).

Related to:

  <https://fedoraproject.org/wiki/Changes/PortingToModernC>
  <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
This commit is contained in:
Florian Weimer 2023-11-22 13:52:29 +01:00
parent e84d11b7da
commit 2957f63ae9
4 changed files with 64 additions and 2 deletions

30
tigervnc-c99-1.patch Normal file
View File

@ -0,0 +1,30 @@
Replace INITARGS with void
Most compilers currently accept arbitrary identifiers in this place
and ignore then, but this is going to change and turn into an error.
Submitted upstream: <https://github.com/TigerVNC/tigervnc/pull/1698>
diff --git a/unix/xserver/hw/vnc/vncModule.c b/unix/xserver/hw/vnc/vncModule.c
index a448c2f1..fb8ce047 100644
--- a/unix/xserver/hw/vnc/vncModule.c
+++ b/unix/xserver/hw/vnc/vncModule.c
@@ -36,7 +36,7 @@
#include "XorgGlue.h"
#include "RandrGlue.h"
-static void vncModuleInit(INITARGS);
+static void vncModuleInit(void);
static MODULESETUPPROTO(vncSetup);
@@ -70,7 +70,7 @@ vncSetup(void * module, void * opts, int *errmaj, int *errmin) {
return (void *)1;
}
-static void vncModuleInit(INITARGS)
+static void vncModuleInit(void)
{
static char once = 0;

23
tigervnc-c99-2.patch Normal file
View File

@ -0,0 +1,23 @@
commit 25a03f430f47733b215eb9f0251e25ce7bdb7ada
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Nov 22 12:57:03 2023 +0100
cmake: Use correct input pointer type for iconv detection
The iconv function expects a char ** pointer argument for the input
pointer. Future C compilers will flag this as an error (as it is not
valid C), causing this probe to fail incorrectly.
diff --git a/cmake/Modules/FindIconv.cmake b/cmake/Modules/FindIconv.cmake
index cf268ea0..9cd899da 100644
--- a/cmake/Modules/FindIconv.cmake
+++ b/cmake/Modules/FindIconv.cmake
@@ -36,7 +36,7 @@ IF(ICONV_FOUND)
#include <iconv.h>
int main(){
iconv_t conv = 0;
- const char* in = 0;
+ char* in = 0;
size_t ilen = 0;
char* out = 0;
size_t olen = 0;

View File

@ -67,7 +67,7 @@ index 5596e21..003fc3c 100644
#include "globals.h"
+#ifdef TIGERVNC
+extern void vncExtensionInit(INITARGS);
+extern void vncExtensionInit(void);
+#endif
+
/* List of built-in (statically linked) extensions */

View File

@ -6,7 +6,7 @@
Name: tigervnc
Version: 1.13.1
Release: 6%{?dist}
Release: 7%{?dist}
Summary: A TigerVNC remote display system
%global _hardened_build 1
@ -31,6 +31,9 @@ Patch1: tigervnc-vncsession-restore-script-systemd-service.patch
# This is tigervnc-%%{version}/unix/xserver116.patch rebased on the latest xorg
Patch100: tigervnc-xserver120.patch
Patch101: tigervnc-c99-1.patch
Patch102: tigervnc-c99-2.patch
BuildRequires: make
BuildRequires: gcc-c++
BuildRequires: gettext
@ -196,6 +199,9 @@ sed -i -e '/add_subdirectory.*vnc/d' unix/CMakeLists.txt
# Downstream patches
%patch101 -p1 -b .c99-1
%patch102 -p1 -b .c99-2
%build
%ifarch sparcv9 sparc64 s390 s390x
export CFLAGS="$RPM_OPT_FLAGS -fPIC"
@ -379,6 +385,9 @@ fi
%{_datadir}/icons/hicolor/*/apps/*
%changelog
* Wed Nov 22 2023 Florian Weimer <fweimer@redhat.com> - 1.13.1-7
- C compatibility fixes
* Thu Nov 02 2023 Jan Grulich <jgrulich@redhat.com> - 1.13.1-6
- Fix CVE-2023-5380 and CVE-2023-5367 (rebuild with fixed Xorg)