community/socklog: fix build with gcc 14

This commit is contained in:
mio 2024-09-10 04:28:32 +00:00 committed by Celeste
parent ecad012775
commit 9a52f96d1f
3 changed files with 211 additions and 4 deletions

View file

@ -2,16 +2,19 @@
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=socklog
pkgver=2.1.0
pkgrel=3
pkgrel=4
pkgdesc="System and kernel logging services for runit"
url="http://smarden.org/socklog/"
arch="all"
license="BSD"
install="$pkgname.post-install"
subpackages="$pkgname-doc"
source="http://smarden.org/$pkgname/$pkgname-$pkgver.tar.gz
source="http://smarden.org/socklog/socklog-$pkgver.tar.gz
socklog.setup
gcc14-incompatible-pointer-types.patch
gcc14-implicit-function-declaration.patch
"
options="!check" # no tests
builddir="$srcdir/admin/socklog-$pkgver/src"
build() {
@ -35,5 +38,9 @@ package() {
install -m754 "$srcdir"/socklog.setup "$pkgdir"/sbin/setup-socklog
}
sha512sums="920ce5e661a6a3d970fa77ee3c228d48699ea03530be2b43b7517458b25e31a0a7f352ece2d076c715b6d34dbb26b424b48eb0f55b9bcd0355b74d3e34c77ac7 socklog-2.1.0.tar.gz
9ff1296eaa3af00659b835a182bd90b2cfbe1c6f18cfd1259845a20d8735f54b2ba6fce3863f0f18ef5c8129a1842d11414d306d9486468ff1be6d34b9364dfd socklog.setup"
sha512sums="
920ce5e661a6a3d970fa77ee3c228d48699ea03530be2b43b7517458b25e31a0a7f352ece2d076c715b6d34dbb26b424b48eb0f55b9bcd0355b74d3e34c77ac7 socklog-2.1.0.tar.gz
9ff1296eaa3af00659b835a182bd90b2cfbe1c6f18cfd1259845a20d8735f54b2ba6fce3863f0f18ef5c8129a1842d11414d306d9486468ff1be6d34b9364dfd socklog.setup
b0136c440960a2eb395f2214d96f22d60216891064fd58007e60d62eba1d99d5a24f622734b6f92d113d0c0f824ad393589d9108197f0e6e8cbc1f87d84f42cf gcc14-incompatible-pointer-types.patch
daf131edebf34dd6d7c997efc80b1f1b97908e441ef762ce7f873c1dfa9ef96a74e3bd8af7285fec13a68dd06cf961ff0d738f9743d13843fa3b1bfef7d495fb gcc14-implicit-function-declaration.patch
"

View file

@ -0,0 +1,55 @@
Fix -Wimplicit-function-declaration error on sigblock() with gcc 14.
```
sig_block.c: In function 'sig_block':
sig_block.c:15:3: error: implicit declaration of function 'sigblock'; did you
mean 'sig_block'? [-Wimplicit-function-declaration]
15 | sigblock(1 << (sig - 1));
| ^~~~~~~~
| sig_block
sig_block.c: In function 'sig_unblock':
sig_block.c:27:3: error: implicit declaration of function 'sigsetmask'; did you
mean 'sigset'? [-Wimplicit-function-declaration]
27 | sigsetmask(sigsetmask(~0) & ~(1 << (sig - 1)));
| ^~~~~~~~~~
| sigset
```
--- a/sig_block.c
+++ b/sig_block.c
@@ -6,35 +6,23 @@
void sig_block(int sig)
{
-#ifdef HASSIGPROCMASK
sigset_t ss;
sigemptyset(&ss);
sigaddset(&ss,sig);
sigprocmask(SIG_BLOCK,&ss,(sigset_t *) 0);
-#else
- sigblock(1 << (sig - 1));
-#endif
}
void sig_unblock(int sig)
{
-#ifdef HASSIGPROCMASK
sigset_t ss;
sigemptyset(&ss);
sigaddset(&ss,sig);
sigprocmask(SIG_UNBLOCK,&ss,(sigset_t *) 0);
-#else
- sigsetmask(sigsetmask(~0) & ~(1 << (sig - 1)));
-#endif
}
void sig_blocknone(void)
{
-#ifdef HASSIGPROCMASK
sigset_t ss;
sigemptyset(&ss);
sigprocmask(SIG_SETMASK,&ss,(sigset_t *) 0);
-#else
- sigsetmask(0);
-#endif
}

View file

@ -0,0 +1,145 @@
Source: https://sources.debian.org/patches/socklog/2.1.0%2Brepack-5.1/0003-patches-fix-build-warnings.patch/
The file paths were adjusted to match the $builddir path.
---
From: Mathieu Mirmont <mat@parad0x.org>
Date: Sat, 7 Nov 2020 23:54:06 +0100
Subject: patches: fix build warnings
---
src/chkshsgr.c | 4 +++-
src/pathexec.h | 2 +-
src/pathexec_run.c | 7 ++++---
src/prot.c | 3 +++
src/seek_set.c | 1 +
src/socklog-conf.c | 2 +-
src/socklog.c | 5 +++--
7 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/chkshsgr.c bchkshsgr.c
index 38c352d..b3c8278 100644
--- a/chkshsgr.c
+++ b/chkshsgr.c
@@ -1,10 +1,12 @@
/* Public domain. */
+#include <sys/types.h>
#include <unistd.h>
+#include <grp.h>
int main()
{
- short x[4];
+ gid_t x[2];
x[0] = x[1] = 0;
if (getgroups(1,x) == 0) if (setgroups(1,x) == -1) _exit(1);
diff --git a/pathexec.h b/src/pathexec.h
index 61da922..dd510d8 100644
--- a/pathexec.h
+++ b/pathexec.h
@@ -3,7 +3,7 @@
#ifndef PATHEXEC_H
#define PATHEXEC_H
-extern void pathexec_run(const char *,const char * const *,const char * const *);
+extern void pathexec_run(const char *, const char * const *, const char * const *);
extern int pathexec_env(const char *,const char *);
extern void pathexec(const char * const *);
diff --git a/pathexec_run.c b/src/pathexec_run.c
index 1770ac7..36ce0f8 100644
--- a/pathexec_run.c
+++ b/pathexec_run.c
@@ -1,5 +1,6 @@
/* Public domain. */
+#include <unistd.h>
#include "error.h"
#include "stralloc.h"
#include "str.h"
@@ -8,14 +9,14 @@
static stralloc tmp;
-void pathexec_run(const char *file,const char * const *argv,const char * const *envp)
+void pathexec_run(const char *file, const char * const *argv, const char * const *envp)
{
const char *path;
unsigned int split;
int savederrno;
if (file[str_chr(file,'/')]) {
- execve(file,argv,envp);
+ execve(file,(char * const *)argv,(char * const *)envp);
return;
}
@@ -32,7 +33,7 @@ void pathexec_run(const char *file,const char * const *argv,const char * const *
if (!stralloc_cats(&tmp,file)) return;
if (!stralloc_0(&tmp)) return;
- execve(tmp.s,argv,envp);
+ execve(tmp.s,(char * const *)argv,(char * const *)envp);
if (errno != error_noent) {
savederrno = errno;
if ((errno != error_acces) && (errno != error_perm) && (errno != error_isdir)) return;
diff --git a/prot.c b/src/prot.c
index 79a88c5..99ed0cc 100644
--- a/prot.c
+++ b/prot.c
@@ -1,5 +1,8 @@
/* Public domain. */
+#include <sys/types.h>
+#include <unistd.h>
+#include <grp.h>
#include "hasshsgr.h"
#include "prot.h"
diff --git a/seek_set.c b/src/seek_set.c
index 19b8265..a1a36d0 100644
--- a/seek_set.c
+++ b/seek_set.c
@@ -1,6 +1,7 @@
/* Public domain. */
#include <sys/types.h>
+#include <unistd.h>
#include "seek.h"
#define SET 0 /* sigh */
diff --git a/socklog-conf.c b/src/socklog-conf.c
index 029816b..82284b5 100644
--- a/socklog-conf.c
+++ b/socklog-conf.c
@@ -73,7 +73,7 @@ void start(const char *s) {
fn = s;
fd = open_trunc(fn);
if (fd == -1) fail();
- buffer_init(&b, write, fd, buf, sizeof buf);
+ buffer_init(&b, (int (*)()) write, fd, buf, sizeof buf);
}
void outs(const char *s) {
diff --git a/socklog.c b/src/socklog.c
index babb9aa..93c784e 100644
--- a/socklog.c
+++ b/socklog.c
@@ -168,7 +168,8 @@ int socket_unix (const char* f) {
strerr_die2sys(111, FATAL, "socket(): ");
byte_zero(&sa, sizeof(sa));
sa.sun_family =AF_UNIX;
- strncpy(sa.sun_path, f, sizeof(sa.sun_path));
+ strncpy(sa.sun_path, f, sizeof(sa.sun_path) - 1);
+ sa.sun_path[sizeof(sa.sun_path) - 1] = '\0';
unlink(f);
if (! noumask) umask(0);
if (bind(s, (struct sockaddr*) &sa, sizeof sa) == -1)
@@ -220,7 +221,7 @@ int read_socket (int s) {
for(;;) {
struct sockaddr_in saf;
- int dummy =sizeof saf;
+ socklen_t dummy =sizeof saf;
int linec;
int os;