[packages/rc-scripts-user] Rel 2. Fix build

arekm arekm at pld-linux.org
Sun Nov 15 12:16:17 CET 2026


commit c8ad13f8003dd21376014fdef31da20ee6a13fe6
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sun Nov 15 12:06:42 2026 +0100

    Rel 2. Fix build

 rc-scripts-user.spec |  9 +++++----
 run-fast-or-hide.c   |  9 +++++++--
 userscripts.init     | 10 ++++++----
 3 files changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/rc-scripts-user.spec b/rc-scripts-user.spec
index 387a346..d54995f 100644
--- a/rc-scripts-user.spec
+++ b/rc-scripts-user.spec
@@ -3,12 +3,12 @@ Summary:	Run user scripts
 Summary(pl.UTF-8):	Uruchom skrypty użytkownika
 Name:		rc-scripts-user
 Version:	1.8
-Release:	1
+Release:	2
 License:	GPL v2+
 Group:		Applications/System
 Source0:	userscripts.init
 Source1:	run-fast-or-hide.c
-URL:		http://www.pld-linux.org/Packages/UserScripts
+URL:		https://www.pld-linux.org/Packages/UserScripts
 BuildRequires:	rpmbuild(macros) >= 1.228
 Requires(post,preun):	/sbin/chkconfig
 Requires:	rc-scripts
@@ -22,10 +22,11 @@ Uruchom skrypty użytkownika przy starcie oraz wyłączaniu systemu.
 
 %prep
 %setup -q -c -T
-awk '/Version/ { v=$4 } END { exit v != "%{version}" }' < %{SOURCE0}
+awk '/Version/ { v=$3 } END { exit v != "%{version}" }' < %{SOURCE0}
+cp -p %{SOURCE1} .
 
 %build
-%{__cc} %{rpmcppflags} %{rpmcppflags} -Wall %{rpmldflags} %{SOURCE1} -o run-fast-or-hide
+%{__cc} %{rpmcflags} %{rpmcppflags} -Wall %{rpmldflags} run-fast-or-hide.c -o run-fast-or-hide
 
 %install
 rm -rf $RPM_BUILD_ROOT
diff --git a/run-fast-or-hide.c b/run-fast-or-hide.c
index b53d85d..788aeaf 100644
--- a/run-fast-or-hide.c
+++ b/run-fast-or-hide.c
@@ -21,6 +21,7 @@
 #include <grp.h> /* initgroups */
 #include <stdio.h>
 #include <fcntl.h> /* O_RDWR */
+#include <errno.h> /* errno */
 
 #ifndef SLEEP_TIME
 /* 100 msec should be more than enough */
@@ -89,8 +90,12 @@ mysleep( long int sleep_usec )
 static int
 run_child( int verbose, struct passwd *pw, int nicelevel, char * const *argv )
 {
-	if ( nicelevel )
-		nice( nicelevel );
+	if ( nicelevel ) {
+		/* nice() may legitimately return -1, only errno tells a failure */
+		errno = 0;
+		if ( nice( nicelevel ) == -1 && errno != 0 )
+			perror( "nice" );
+	}
 
 	if ( pw != NULL ) {
  		if ( setgid( pw->pw_gid ) )
diff --git a/userscripts.init b/userscripts.init
index bf093d1..b19214e 100644
--- a/userscripts.init
+++ b/userscripts.init
@@ -2,7 +2,7 @@
 #
 # userscripts:	Executes user-defined events.
 #
-# Version:	$Revision$
+# Version:	1.8
 #
 # chkconfig:	345 99 01
 # description:	Executes $HOME/.config/init.d/* start on startup,
@@ -70,7 +70,7 @@ run_scripts()
 
 	SCRIPTS_RUN=0
 	local IFS=":"
-	getent passwd | while read user pass uid gid name home shell; do
+	while read user pass uid gid name home shell; do
 		[ -d "$home/$scripts_dir" ] || continue
 
 		if ! is_allowed "$user" "$shell"; then
@@ -103,7 +103,7 @@ run_scripts()
 				continue
 			fi
 
-			su - "$user" -s /bin/sh -c "exec /sbin/run-fast-or-hide -n '$NICE' $RUN_ARGS -- '$script' '$action'"
+			su - "$user" -s /bin/sh -c "exec /sbin/run-fast-or-hide -n '$NICE' $RUN_ARGS -- '$script' '$action'" < /dev/null
 			local RET=$?
 			deltext
 			if [ $RET -eq 250 ]; then
@@ -113,7 +113,9 @@ run_scripts()
 				[ $RET -eq 0 ] && ok || fail
 			fi
 		done
-	done
+	done <<-EOF
+	$(getent passwd)
+	EOF
 }
 
 start()
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rc-scripts-user.git/commitdiff/90f00166cd4dd2f4104132d9469dd081e2c5e25f



More information about the pld-cvs-commit mailing list