summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/procps/procps/0001-src-w.c-use-utmp.h-only.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/procps/procps/0001-src-w.c-use-utmp.h-only.patch')
-rw-r--r--meta/recipes-extended/procps/procps/0001-src-w.c-use-utmp.h-only.patch65
1 files changed, 65 insertions, 0 deletions
diff --git a/meta/recipes-extended/procps/procps/0001-src-w.c-use-utmp.h-only.patch b/meta/recipes-extended/procps/procps/0001-src-w.c-use-utmp.h-only.patch
new file mode 100644
index 0000000000..23c91ec775
--- /dev/null
+++ b/meta/recipes-extended/procps/procps/0001-src-w.c-use-utmp.h-only.patch
@@ -0,0 +1,65 @@
1From c41b3be62fbb78e0939fddaebad519360cbd8702 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex@linutronix.de>
3Date: Mon, 6 Mar 2023 09:27:57 +0100
4Subject: [PATCH] src/w.c: use only utmpx
5
6Nowadays this works both on musl and glibc systems, however on musl
7utmp.h is also needed to avoid the following failure:
8
9| ../git/src/w.c: In function 'print_from':
10| ../git/src/w.c:73:28: error: '__UT_HOSTSIZE' undeclared (first use in this function); did you mean 'UT_HOSTSIZE'?
11| 73 | # define UT_HOSTSIZE __UT_HOSTSIZE
12| | ^~~~~~~~~~~~~
13| ../git/src/w.c:233:64: note: in expansion of macro 'UT_HOSTSIZE'
14| 233 | print_display_or_interface(u->ut_host, UT_HOSTSIZE, fromlen - len);
15| | ^~~~~~~~~~~
16|
17
18It is caused by including utmpx.h, but not utmp.h, which (on musl)
19lacks the needed definitions.
20
21I have verified that both musl and glibc based builds continue to work.
22
23Upstream-Status: Submitted [https://gitlab.com/procps-ng/procps/-/merge_requests/171]
24Signed-off-by: Alexander Kanavin <alex@linutronix.de>
25
26---
27 src/w.c | 17 ++---------------
28 1 file changed, 2 insertions(+), 15 deletions(-)
29
30diff --git a/src/w.c b/src/w.c
31index 5e878f04..912c5df3 100644
32--- a/src/w.c
33+++ b/src/w.c
34@@ -46,11 +46,8 @@
35 #include <termios.h>
36 #include <time.h>
37 #include <unistd.h>
38-#ifdef HAVE_UTMPX_H
39-# include <utmpx.h>
40-#else
41-# include <utmp.h>
42-#endif
43+#include <utmp.h>
44+#include <utmpx.h>
45 #include <arpa/inet.h>
46
47 #include "c.h"
48@@ -63,17 +60,7 @@
49 static int ignoreuser = 0; /* for '-u' */
50 static int oldstyle = 0; /* for '-o' */
51
52-#ifdef HAVE_UTMPX_H
53 typedef struct utmpx utmp_t;
54-#else
55-typedef struct utmp utmp_t;
56-#endif
57-
58-#if !defined(UT_HOSTSIZE) || defined(__UT_HOSTSIZE)
59-# define UT_HOSTSIZE __UT_HOSTSIZE
60-# define UT_LINESIZE __UT_LINESIZE
61-# define UT_NAMESIZE __UT_NAMESIZE
62-#endif
63
64 #ifdef W_SHOWFROM
65 # define FROM_STRING "on"