Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37418384
en ru br
Репозитории ALT

Группа :: Система/Настройка/Загрузка и инициализация
Пакет: sysvinit

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: 0005-OWL-Fixes.patch
Скачать


From 39ff7c071681f2a60a257736a00ebee5cb94fd57 Mon Sep 17 00:00:00 2001
From: Alexey Gladkov <legion@altlinux.org>
Date: Thu, 16 Dec 2021 18:37:59 +0300
Subject: OWL: Fixes
---
 src/init.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/init.c b/src/init.c
index e319815..629302d 100644
--- a/src/init.c
+++ b/src/init.c
@@ -1019,6 +1019,9 @@ void init_freeenv(char **e)
 {
 	int		n;
 
+	if (!e)
+		return;
+
 	for (n = 0; e[n]; n++)
 		free(e[n]);
 	free(e);
@@ -2248,7 +2251,7 @@ void my_re_exec(void)
 	CHILD		*ch;
 	sigset_t	mask, oldset;
 	pid_t		pid;
-	char		**env;
+	char		**env = 0;
 	int		fd;
 
 	if (strchr("S0123456",runlevel) == NULL)
@@ -2297,11 +2300,13 @@ void my_re_exec(void)
 		exit(0);
 	}
 
-	/*
-	 *	The existing init process execs a new init binary.
-	 */
-	env = init_buildenv(0);
-	execle(myname, myname, "--init", NULL, env);
+	if (pid > 0) {
+		/*
+		 *	The existing init process execs a new init binary.
+		 */
+		env = init_buildenv(0);
+		execle(myname, myname, "--init", NULL, env);
+	}
 
 	/*
 	 *	We shouldn't be here, something failed. 
@@ -2964,14 +2969,14 @@ void init_main(void)
  */
 __attribute__((noreturn))
 static
-void usage(char *s)
+void usage(const char *s)
 {
 	fprintf(stderr, "Usage: %s {-e VAR[=VAL] | [-t SECONDS] {0|1|2|3|4|5|6|S|s|Q|q|A|a|B|b|C|c|U|u}}\n", s);
 	exit(1);
 }
 
 static
-int telinit(char *progname, int argc, char **argv)
+int telinit(const char *progname, int argc, char **argv)
 {
 #ifdef TELINIT_USES_INITLVL
 	FILE			*fp;
-- 
2.25.4
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin