Blame SOURCES/0005-Ticket-48144-Add-usr-sbin-status-dirsrv-script-to-ge.patch

7c7f29
From 1de87b6fa85221c874bc4449d81655302540ec22 Mon Sep 17 00:00:00 2001
7c7f29
From: Noriko Hosoi <nhosoi@redhat.com>
7c7f29
Date: Mon, 11 Jul 2016 19:09:24 -0700
7c7f29
Subject: [PATCH 05/15] Ticket #48144 - Add /usr/sbin/status-dirsrv script to
7c7f29
 get the status of the directory server instance.
7c7f29
7c7f29
Description:
7c7f29
Analysis by vashirov@redhat.com:
7c7f29
  https://bugzilla.redhat.com/show_bug.cgi?id=1209128#c11
7c7f29
  The error comes from bash built-in `return`. bash version prior to
7c7f29
  4.3 didn't support negative numbers as argument for `return`.
7c7f29
  See for reference: http://wiki.bash-hackers.org/scripting/bashchanges
7c7f29
7c7f29
As suggested in the comment, instead of -1, 255 should be returned in
7c7f29
this error case:
7c7f29
  > 255 is returned if the instance does not exist.
7c7f29
7c7f29
https://fedorahosted.org/389/ticket/48144
7c7f29
7c7f29
Viktor's proposal is reviewed by nhosoi@redhat.com.
7c7f29
7c7f29
(cherry picked from commit a8b07cd2671c82421830ae94584b370436ef3434)
7c7f29
---
7c7f29
 ldap/admin/src/scripts/status-dirsrv.in | 4 ++--
7c7f29
 1 file changed, 2 insertions(+), 2 deletions(-)
7c7f29
7c7f29
diff --git a/ldap/admin/src/scripts/status-dirsrv.in b/ldap/admin/src/scripts/status-dirsrv.in
7c7f29
index 0f01eaa..9042899 100755
7c7f29
--- a/ldap/admin/src/scripts/status-dirsrv.in
7c7f29
+++ b/ldap/admin/src/scripts/status-dirsrv.in
7c7f29
@@ -11,14 +11,14 @@ status_instance() {
7c7f29
     SERV_ID=$1
7c7f29
     shift
7c7f29
 
7c7f29
-    initfile=`get_init_file $initconfig_dir $SERV_ID` || { echo Instance $SERV_ID not found. ; return -1 ; }
7c7f29
+    initfile=`get_init_file $initconfig_dir $SERV_ID` || { echo Instance $SERV_ID not found. ; return 255 ; }
7c7f29
 
7c7f29
     # source env. for this instance
7c7f29
     if [ -f $initfile ] ; then
7c7f29
         . $initfile
7c7f29
     else
7c7f29
         echo Instance $SERV_ID not found.
7c7f29
-        return -1
7c7f29
+        return 255
7c7f29
     fi
7c7f29
 
7c7f29
     prefix="$DS_ROOT"
7c7f29
-- 
7c7f29
2.4.11
7c7f29