Package: dpkg
Version: 1.10
Severity: wishlist
File: /sbin/start-stop-daemon
Tags: patch

Well everything is in the subject, a chdir option can be useful for
certain program which are not every user friendly and must be launch in
the right directory. Here is a patch to do this.

--
Loïc

"heaven is not a place, it's a feeling"

-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux alibaba 2.4.18 #1 Thu May 23 16:58:14 CEST 2002 i686
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED]

Versions of packages dpkg depends on:
ii  dselect                       1.10       a user tool to manage Debian packa
ii  libc6                         2.2.5-7    GNU C Library: Shared libraries an

-- no debconf information


diff -ru dpkg-1.10.orig/utils/start-stop-daemon.8 
dpkg-1.10/utils/start-stop-daemon.8
--- dpkg-1.10.orig/utils/start-stop-daemon.8    Sun May 26 05:53:43 2002
+++ dpkg-1.10/utils/start-stop-daemon.8 Wed Jul  3 15:47:03 2002
@@ -181,6 +181,12 @@
 before starting the process. Please note that the pidfile is also written
 after the chroot.
 .TP
+\fB-d\fP|\fB--chdir\fP \fIpath\fP
+Chdir to
+.I path
+before starting the process. This is done after the chroot if the
+\fB-r\fP|\fB--chroot\fP option is set.
+.TP
 .BR -b | --background
 Typically used with programs that don't detach on their own. This option
 will force
diff -ru dpkg-1.10.orig/utils/start-stop-daemon.c 
dpkg-1.10/utils/start-stop-daemon.c
--- dpkg-1.10.orig/utils/start-stop-daemon.c    Sun May 19 09:35:12 2002
+++ dpkg-1.10/utils/start-stop-daemon.c Wed Jul  3 15:50:25 2002
@@ -107,6 +107,7 @@
 static char *changeuser = NULL;
 static const char *changegroup = NULL;
 static char *changeroot = NULL;
+static char *changedir = NULL;
 static const char *cmdname = NULL;
 static char *execname = NULL;
 static char *startas = NULL;
@@ -271,6 +272,8 @@
 "  -p|--pidfile <pid-file>       pid file to check\n"
 "  -c|--chuid <name|uid[:group|gid]>\n"
 "              change to this user/group before starting process\n"
+"  -d|--chdir <path>\n"
+"               change the current directory to path before starting process\n"
 "  -u|--user <username>|<uid>    stop processes owned by this user\n"
 "  -n|--name <process-name>      stop processes with this name\n"
 "  -s|--signal <signal>          signal to send (default TERM)\n"
@@ -462,12 +465,13 @@
                { "background",   0, NULL, 'b'},
                { "make-pidfile", 0, NULL, 'm'},
                { "retry",        1, NULL, 'R'},
+               { "chdir",        1, NULL, 'd'},
                { NULL,         0, NULL, 0}
        };
        int c;
 
        for (;;) {
-               c = getopt_long(argc, argv, "HKSVa:n:op:qr:s:tu:vx:c:N:bmR:",
+               c = getopt_long(argc, argv, "HKSVa:n:op:qr:s:tu:vx:c:N:bmR:d:",
                                longopts, (int *) 0);
                if (c == -1)
                        break;
@@ -536,6 +540,9 @@
                case 'R':  /* --retry <schedule>|<timeout> */
                        schedule_str = optarg;
                        break;
+               case 'd':  /* --chdir /new/dir */
+                       changedir = optarg;
+                       break;
                default:
                        badusage(NULL);  /* message printed by getopt */
                }
@@ -1188,6 +1195,10 @@
                        fatal("Unable to chdir() to %s", changeroot);
                if (chroot(changeroot) < 0)
                        fatal("Unable to chroot() to %s", changeroot);
+       }
+       if (changedir != NULL) {
+               if (chdir(changedir) < 0)
+                       fatal("Unable to chdir() to %s", changedir);
        }
        if (changeuser != NULL) {
                if (setgid(runas_gid))



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]


Reply via email to