summary refs log tree commit diff
diff options
context:
space:
mode:
authorGerrit Pape <pape@smarden.org>2008-04-20 20:38:57 +0000
committerGerrit Pape <pape@smarden.org>2008-04-20 20:38:57 +0000
commited673f8f525aead9418d34faea94b83c71b4eaa7 (patch)
treece3dd102dc86c70d1b28b6563386c6b3e3aa32c6
parent1e83f029d97222fdbda1a26a920199528e72e72d (diff)
downloadrunit-ed673f8f525aead9418d34faea94b83c71b4eaa7.tar.gz
runit-ed673f8f525aead9418d34faea94b83c71b4eaa7.tar.xz
runit-ed673f8f525aead9418d34faea94b83c71b4eaa7.zip
sv.c: service name is also relative to the current directory if it ends with a slash.
-rw-r--r--man/sv.84
-rw-r--r--package/CHANGES2
-rw-r--r--src/sv.c3
3 files changed, 6 insertions, 3 deletions
diff --git a/man/sv.8 b/man/sv.8
index 3d538c0..9de05e4 100644
--- a/man/sv.8
+++ b/man/sv.8
@@ -28,8 +28,8 @@ used by
 .BR runsv (8).
 If
 .I service
-doesn't start with a dot or slash, it is searched in the default services
-directory
+doesn't start with a dot or slash and doesn't end with a slash, it is
+searched in the default services directory
 .IR /var/service/ ,
 otherwise relative to the current directory.
 .P
diff --git a/package/CHANGES b/package/CHANGES
index 667ed2f..b026c96 100644
--- a/package/CHANGES
+++ b/package/CHANGES
@@ -1,4 +1,6 @@
   * doc/upgrade.html: typo.
+  * sv.c: service name is also relative to the current directory if it
+    ends with a slash.
 
 1.8.0
 Fri, 21 Sep 2007 00:33:56 +0000
diff --git a/src/sv.c b/src/sv.c
index 855ae39..0559abe 100644
--- a/src/sv.c
+++ b/src/sv.c
@@ -331,7 +331,8 @@ int main(int argc, char **argv) {
 
   servicex =service;
   for (i =0; i < services; ++i) {
-    if ((**service != '/') && (**service != '.')) {
+    if ((**service != '/') && (**service != '.') && **service &&
+        ((*service)[str_len(*service) -1] != '/')) {
       if ((chdir(varservice) == -1) || (chdir(*service) == -1)) {
         fail("unable to change to service directory");
         *service =0;