Author: guillem
Date: 2006-04-04 01:55:37 +0000 (Tue, 04 Apr 2006)
New Revision: 214

Modified:
   trunk/ChangeLog
   trunk/debian/changelog
   trunk/utils/start-stop-daemon.c
Log:
Prefix any chroot path to the exec file name when stating it in
start-stop-daemon. Closes: #318771, #333066


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2006-03-30 01:20:11 UTC (rev 213)
+++ trunk/ChangeLog     2006-04-04 01:55:37 UTC (rev 214)
@@ -1,3 +1,8 @@
+2006-04-04  Guillem Jover  <[EMAIL PROTECTED]>
+
+       * utils/start-stop-daemon.c (main): Prefix the chroot path, if any,
+       when stating the exec file.
+
 2006-03-30  Guillem Jover  <[EMAIL PROTECTED]>
 
        * src/main.c (setforce): Add a '[!]' next to 'all' to denote that

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2006-03-30 01:20:11 UTC (rev 213)
+++ trunk/debian/changelog      2006-04-04 01:55:37 UTC (rev 214)
@@ -21,6 +21,8 @@
   [ Guillem Jover ]
   * Add a '[!]' in --force-all help denoting that it is a dangerous option.
     Closes: #359935
+  * Prefix any chroot path to the exec file name when stating it in
+    start-stop-daemon. Closes: #318771, #333066
 
  -- Christian Perrier <[EMAIL PROTECTED]>  Tue, 21 Mar 2006 20:46:24 +0100
 

Modified: trunk/utils/start-stop-daemon.c
===================================================================
--- trunk/utils/start-stop-daemon.c     2006-03-30 01:20:11 UTC (rev 213)
+++ trunk/utils/start-stop-daemon.c     2006-04-04 01:55:37 UTC (rev 214)
@@ -1193,9 +1193,26 @@
        argc -= optind;
        argv += optind;
 
-       if (execname && stat(execname, &exec_stat))
-               fatal("stat %s: %s", execname, strerror(errno));
+       if (execname) {
+               char *fullexecname;
 
+               if (changeroot) {
+                       int fullexecname_len = strlen(changeroot) + 1 +
+                                              strlen(execname) + 1;
+
+                       fullexecname = xmalloc(fullexecname_len);
+                       snprintf(fullexecname, fullexecname_len, "%s/%s",
+                                changeroot, execname);
+               } else
+                       fullexecname = execname;
+
+               if (stat(fullexecname, &exec_stat))
+                       fatal("stat %s: %s", fullexecname, strerror(errno));
+
+               if (fullexecname != execname)
+                       free(fullexecname);
+       }
+
        if (userspec && sscanf(userspec, "%d", &user_id) != 1) {
                struct passwd *pw;
 


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

Reply via email to