summary refs log tree commit diff
diff options
context:
space:
mode:
-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;