Skip to contentSkip to conversation

sysvinit: backport patch for fixing one issue of pidof

PATCH Changqing Li 1 participant 1 message Nov 20, 2024 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

master branch also has this issue,  plan to upgrade sysvinit to fix it.

//Changqing

Quoted 77 lines · Changqing Li via lists.openembedded.org

From: Changqing Li<[email protected]>

When a program is a link to an executable, and this executable is handled by update-alternatives, renamed to a different name, cmd pidof full_path_of_program will not work.

Eg:
/usr/sbin/httpd -> /usr/sbin/httpd.apache2
pidof /usr/sbin/httpd cannot get pid of the process httpd

Backport the patch to fix above issue.

---
  ...rom-Mark-Hindley-which-avoids-cleari.patch | 31 +++++++++++++++++++
  meta/recipes-core/sysvinit/sysvinit_3.04.bb   |  1 +
  2 files changed, 32 insertions(+)

create mode 100644 meta/recipes-core/sysvinit/sysvinit/0001-Accepted-patch-from-Mark-Hindley-which-avoids-cleari.patch

meta/recipes-core/sysvinit/sysvinit/0001-Accepted-patch-from-Mark-Hindley-which-avoids-cleari.patch new file +31 -0
new file mode 100644
index 0000000000..33c9f62eac
@@ -0,0 +1,31 @@
+From 5be52641a10ad6cd89bc7cdb80318e32be7e6662 Mon Sep 17 00:00:00 2001
+From: Jesse<[email protected]>
+Date: Wed, 29 Mar 2023 10:34:45 -0300
+Subject: [PATCH] Accepted patch from Mark Hindley which avoids clearing
+ realpath information in pidof when trying to find matching executables.
+
+Upstream-Status: Backport [https://github.com/slicer69/sysvinit/commit/c06458e1c1822a2c8ff89fbdd29262ca97dd18b1#diff-4244fa301bd80b0a8f553ce0751fb0fcde1a45ee9dee71db85135cffde8ac712R13]
+
+Signed-off-by: Changqing Li<[email protected]>
+
+---
+ src/killall5.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/killall5.c b/src/killall5.c
+index 86866b0..f7a401e 100644
+--- a/src/killall5.c
++++ b/src/killall5.c
+@@ -766,8 +766,8 @@ PIDQ_HEAD *pidof(char *prog)
+ 		return NULL;
+
+ 	/* Try to stat the executable. */
++	memset(real_path, 0, sizeof(real_path));
+ 	if ( (prog[0] == '/') && ( realpath(prog, real_path) ) ) {
+-		memset(&real_path[0], 0, sizeof(real_path));
+ 		dostat++;
+ 	}
+
+--
+2.25.1
+
meta/recipes-core/sysvinit/sysvinit_3.04.bb +1 -1
index 1dd5f575d2..d3f77d8150 100644
@@ -23,6 +23,7 @@ SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.xz \
             file://bootlogd.init  \
             file://01_bootlogd  \
             file://0001-hddown-include-libgen.h-for-basename-API.patch  \
+file://0001-Accepted-patch-from-Mark-Hindley-which-avoids-cleari.patch  \
             "
  SRC_URI[sha256sum] = "2a621fe6e4528bc91308b74867ddaaebbdf7753f02395c0c5bae817bd2b7e3a5"
 
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#207409):https://lists.openembedded.org/g/openembedded-core/message/207409 Mute This Topic:https://lists.openembedded.org/mt/109679455/3616873
Group Owner:[email protected] Unsubscribe:https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-