Test
OBS-URL: https://build.opensuse.org/package/show/Base:System/blog?expand=0&rev=47
This commit is contained in:
parent
c53fe95a8d
commit
2a813f915b
123
fcb9e0c2.patch
123
fcb9e0c2.patch
@ -1,32 +1,99 @@
|
||||
From fcb9e0c20bc4fee9152f58a6746334f6f1bbe9b1 Mon Sep 17 00:00:00 2001
|
||||
From: Werner Fink <werner@suse.de>
|
||||
Date: Thu, 2 Dec 2021 15:59:55 +0100
|
||||
Subject: [PATCH] On s390/x and PPC64 gcc misses unused arg0
|
||||
|
||||
Signed-off-by: Werner Fink <werner@suse.de>
|
||||
---
|
||||
blogger.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git blogger.c blogger.c
|
||||
index d1e1ae2..ce2b9ee 100644
|
||||
--- blogger.c
|
||||
+++ blogger.c
|
||||
@@ -17,10 +17,14 @@
|
||||
#include <unistd.h>
|
||||
#include "libblogger.h"
|
||||
diff --git blogctl.8 blogctl.8
|
||||
index 93f29b4..cbbfc06 100644
|
||||
--- blogctl.8
|
||||
+++ blogctl.8
|
||||
@@ -53,6 +53,14 @@ This let the daemon disconnect from system console.
|
||||
.TP
|
||||
.B reactivate
|
||||
Whereas this cause the daemon reconnect to system console.
|
||||
+.TP
|
||||
+.B final
|
||||
+Let rename the daemon an open log file
|
||||
+.I /var/log/boot.log
|
||||
+to the new name
|
||||
+.I /var/log/boot.old
|
||||
+as well as mask it own program name in the process table
|
||||
+with the @ character.
|
||||
.SH SEE ALSO
|
||||
.BR blogd (8),
|
||||
.BR systemd (1),
|
||||
diff --git blogd.c blogd.c
|
||||
index 9f322e9..0ca0f9e 100644
|
||||
--- blogd.c
|
||||
+++ blogd.c
|
||||
@@ -221,7 +221,6 @@ static volatile pid_t pid = -1;
|
||||
|
||||
+volatile char *arg0;
|
||||
+
|
||||
int main(int argc, char * argv[])
|
||||
static void flush_handler (void) attribute((noinline));
|
||||
static void exit_handler (void) attribute((noinline));
|
||||
-volatile char *arg0;
|
||||
|
||||
/*
|
||||
* Now do the job
|
||||
@@ -230,6 +229,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
int c, lvl = 'n';
|
||||
char ptsname[NAME_MAX+1];
|
||||
const char *tty, *stt;
|
||||
+ volatile char *arg0;
|
||||
struct console *c;
|
||||
struct termios o;
|
||||
struct winsize w;
|
||||
@@ -248,6 +248,7 @@ int main(int argc, char *argv[])
|
||||
warn("could not tell system to show its status");
|
||||
|
||||
+ arg0 = (volatile char*)argv[0];
|
||||
arg0 = (volatile char*)argv[0];
|
||||
+ remember_arg0(arg0);
|
||||
|
||||
while ((arg = getopt(argc, argv, "f")) != -1) {
|
||||
switch (arg) {
|
||||
diff --git libconsole/console.c libconsole/console.c
|
||||
index b3a499b..89ae1e5 100644
|
||||
--- libconsole/console.c
|
||||
+++ libconsole/console.c
|
||||
@@ -50,7 +50,17 @@
|
||||
#endif
|
||||
|
||||
int final = 0;
|
||||
-extern volatile char *arg0;
|
||||
+static volatile char *_arg0;
|
||||
+
|
||||
while ((c = getopt(argc, argv, "ndfsu")) != -1) {
|
||||
switch (c) {
|
||||
case B_NOTICE:
|
||||
--
|
||||
2.26.2
|
||||
|
||||
+/*
|
||||
+ * Avoid trouble if linked with e.g. blogger as there
|
||||
+ * is no external arg0 but linker on ppc64 and s390/x
|
||||
+ * seems to expect this.
|
||||
+ */
|
||||
+void remember_arg0(volatile char *arg0)
|
||||
+{
|
||||
+ _arg0 = arg0;
|
||||
+}
|
||||
|
||||
/*
|
||||
* Used to ignore some signals during epoll_pwait(2) or ppoll(2)
|
||||
@@ -1044,13 +1054,13 @@ static void socket_handler(int fd)
|
||||
enqry = ANSWER_ACK;
|
||||
safeout(fd, enqry, strlen(enqry)+1, SSIZE_MAX);
|
||||
|
||||
- if (!final) {
|
||||
+ if (!final && _arg0) {
|
||||
int ret;
|
||||
|
||||
final = 1;
|
||||
|
||||
- if (arg0[0] != '@')
|
||||
- arg0[0] = '@';
|
||||
+ if (_arg0[0] != '@')
|
||||
+ _arg0[0] = '@';
|
||||
|
||||
ret = rename(BOOT_LOGFILE, BOOT_OLDLOGFILE);
|
||||
if (ret < 0) {
|
||||
diff --git libconsole/libconsole.h libconsole/libconsole.h
|
||||
index d14fda5..7151d16 100644
|
||||
--- libconsole/libconsole.h
|
||||
+++ libconsole/libconsole.h
|
||||
@@ -122,6 +122,7 @@ extern int evmax;
|
||||
extern volatile sig_atomic_t signaled;
|
||||
extern volatile sig_atomic_t nsigsys;
|
||||
|
||||
+extern void remember_arg0(volatile char *arg0);
|
||||
extern ssize_t safein (int fd, void *ptr, size_t s);
|
||||
extern void safeout (int fd, const void *ptr, size_t s, ssize_t max);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user