public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
* [PATCH] Fix in pakfire functions.sh
@ 2016-06-10  8:13 Jonatan Schlag
  0 siblings, 0 replies; only message in thread
From: Jonatan Schlag @ 2016-06-10  8:13 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 1167 bytes --]

The if statement in line 89 and 99 are useless with the -e
conditional expression because it returns true if the path ist a
regular file or a directory.
So "/etc/init.d/ " returns true and "/etc/init.d/avahi" return also true,
but the statement should return only true if we have a regular file.
So -f if the right conditional expression, and we only try to execute
the init script if the path "/etc/init.d/${1}" points to a regular file.

Signed-off-by: Jonatan Schlag <jonatan.schlag(a)ipfire.org>
---
 src/pakfire/lib/functions.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pakfire/lib/functions.sh b/src/pakfire/lib/functions.sh
index 3f7dbff..3751697 100644
--- a/src/pakfire/lib/functions.sh
+++ b/src/pakfire/lib/functions.sh
@@ -86,7 +86,7 @@ start_service() {
 		esac
 	done
 
-	if [ -e "/etc/init.d/${1}" ]; then
+	if [ -f "/etc/init.d/${1}" ]; then
 	    if [ -n "${BACKGROUND}" ]; then
 				(sleep ${DELAY} && /etc/init.d/${1} start) &
 			else
@@ -96,7 +96,7 @@ start_service() {
 }
 
 stop_service() {
-	if [ -e "/etc/init.d/${1}" ]; then
+	if [ -f "/etc/init.d/${1}" ]; then
 		/etc/init.d/${1} stop
 	fi
 }
-- 
2.1.4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-06-10  8:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-10  8:13 [PATCH] Fix in pakfire functions.sh Jonatan Schlag

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox