+2006-04-04 Guillem Jover <guillem@debian.org>
+
+ * utils/start-stop-daemon.c (main): Prefix the chroot path, if any,
+ when stating the exec file.
+
2006-03-30 Guillem Jover <guillem@debian.org>
* src/main.c (setforce): Add a '[!]' next to 'all' to denote that
[ 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 <bubulle@debian.org> Tue, 21 Mar 2006 20:46:24 +0100
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;