along with this program; If not, see <http://www.gnu.org/licenses/>.
*/
+#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
static void lu_close_dump_state(struct lu_dump_state *state)
{
}
+
+static char *lu_exec(const void *ctx, int argc, char **argv)
+{
+ return "NYI";
+}
#else
static const char *lu_binary(const void *ctx, struct connection *conn,
const char *filename)
unlink(filename);
talloc_free(filename);
}
+
+static char *lu_exec(const void *ctx, int argc, char **argv)
+{
+ argv[0] = lu_status->filename;
+ execvp(argv[0], argv);
+
+ return "Error activating new binary.";
+}
#endif
static bool lu_check_lu_allowed(void)
static const char *lu_activate_binary(const void *ctx)
{
- return "Not yet implemented.";
+ int argc;
+ char **argv;
+ unsigned int i;
+
+ if (lu_status->cmdline) {
+ argc = 4; /* At least one arg + progname + "-U" + NULL. */
+ for (i = 0; lu_status->cmdline[i]; i++)
+ if (isspace(lu_status->cmdline[i]))
+ argc++;
+ argv = talloc_array(ctx, char *, argc);
+ if (!argv)
+ return "Allocation failure.";
+
+ i = 0;
+ argc = 1;
+ argv[1] = strtok(lu_status->cmdline, " \t");
+ while (argv[argc]) {
+ if (!strcmp(argv[argc], "-U"))
+ i = 1;
+ argc++;
+ argv[argc] = strtok(NULL, " \t");
+ }
+
+ if (!i) {
+ argv[argc++] = "-U";
+ argv[argc] = NULL;
+ }
+ } else {
+ for (i = 0; i < orig_argc; i++)
+ if (!strcmp(orig_argv[i], "-U"))
+ break;
+
+ argc = orig_argc;
+ argv = talloc_array(ctx, char *, orig_argc + 2);
+ if (!argv)
+ return "Allocation failure.";
+
+ memcpy(argv, orig_argv, orig_argc * sizeof(*argv));
+ if (i == orig_argc)
+ argv[argc++] = "-U";
+ argv[argc] = NULL;
+ }
+
+ domain_deinit();
+
+ return lu_exec(ctx, argc, argv);
}
static bool do_lu_start(struct delayed_request *req)