X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ui%2Ftwin%2Fmain-generic.c;h=8ed46b72c41d113a120de88847e770321606cc95;hb=6eb39a03bf66d91c37ca5d14dd61a90850a921d3;hp=ce6a5739e6f58351c5b47d10568cc56241537872;hpb=e95497494f2c0d376c8cdb25548138c5f53cd77c;p=petitboot diff --git a/ui/twin/main-generic.c b/ui/twin/main-generic.c index ce6a573..8ed46b7 100644 --- a/ui/twin/main-generic.c +++ b/ui/twin/main-generic.c @@ -199,7 +199,7 @@ fail_menu: return NULL; } -static int kexec_cb(__attribute__((unused)) struct pbt_client *client, struct pb_opt_data *opt_data) +static int kexec_cb(struct pbt_client *client, struct pb_opt_data *opt_data) { int result; @@ -207,7 +207,7 @@ static int kexec_cb(__attribute__((unused)) struct pbt_client *client, struct pb pb_log("%s: %s\n", __func__, opt_data->name); - result = pb_run_kexec(opt_data->kd); + result = pb_run_kexec(opt_data->kd, client->dry_run); return result; } @@ -215,7 +215,7 @@ static int kexec_cb(__attribute__((unused)) struct pbt_client *client, struct pb static int run(struct pbt_client *client) { while (1) { - int result = waiter_poll(); + int result = waiter_poll(client->waitset); if (result < 0 && errno != EINTR) { pb_log("%s: poll: %s\n", __func__, strerror(errno)); @@ -285,7 +285,6 @@ int main(int argc, char *argv[]) static struct pbt_opts opts; int result; int ui_result; - FILE *log; struct pbt_client *client; result = pbt_opts_parse(&opts, argc, argv); @@ -305,9 +304,13 @@ int main(int argc, char *argv[]) return EXIT_SUCCESS; } - log = fopen(opts.log_file, "a"); - assert(log); - pb_log_set_stream(log); + if (strcmp(opts.log_file, "-")) { + FILE *log = fopen(opts.log_file, "a"); + + assert(log); + pb_log_set_stream(log); + } else + pb_log_set_stream(stderr); #if defined(DEBUG) pb_log_always_flush(1); @@ -327,8 +330,8 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } - client = pbt_client_init(opts.backend, 900, 300, kexec_cb, - opts.start_daemon); + client = pbt_client_init(opts.backend, 1024, 640, kexec_cb, + opts.start_daemon, opts.dry_run); if (!client) { ui_result = EXIT_FAILURE;