diff mbox

[v2,3/4] replay: Set error location properly when parsing options

Message ID 1455303747-19776-4-git-send-email-ehabkost@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eduardo Habkost Feb. 12, 2016, 7:02 p.m. UTC
Set error location so the error_report() calls will show
appropriate command-line argument or config file info.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 replay/replay.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Marcel Apfelbaum Feb. 12, 2016, 7:34 p.m. UTC | #1
On 02/12/2016 09:02 PM, Eduardo Habkost wrote:
> Set error location so the error_report() calls will show
> appropriate command-line argument or config file info.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>   replay/replay.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/replay/replay.c b/replay/replay.c
> index 9cac178..f8739c2 100644
> --- a/replay/replay.c
> +++ b/replay/replay.c
> @@ -262,6 +262,14 @@ void replay_configure(QemuOpts *opts)
>       const char *fname;
>       const char *rr;
>       ReplayMode mode = REPLAY_MODE_NONE;
> +    Location loc;
> +
> +    if (!opts) {
> +        return;
> +    }
> +
> +    loc_push_none(&loc);
> +    qemu_opts_loc_restore(opts);
>
>       rr = qemu_opt_get(opts, "rr");
>       if (!rr) {
> @@ -283,6 +291,8 @@ void replay_configure(QemuOpts *opts)
>       }
>
>       replay_enable(fname, mode);
> +
> +    loc_pop(&loc);
>   }
>
>   void replay_start(void)
>

Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>


Thanks,
Marcel
diff mbox

Patch

diff --git a/replay/replay.c b/replay/replay.c
index 9cac178..f8739c2 100644
--- a/replay/replay.c
+++ b/replay/replay.c
@@ -262,6 +262,14 @@  void replay_configure(QemuOpts *opts)
     const char *fname;
     const char *rr;
     ReplayMode mode = REPLAY_MODE_NONE;
+    Location loc;
+
+    if (!opts) {
+        return;
+    }
+
+    loc_push_none(&loc);
+    qemu_opts_loc_restore(opts);
 
     rr = qemu_opt_get(opts, "rr");
     if (!rr) {
@@ -283,6 +291,8 @@  void replay_configure(QemuOpts *opts)
     }
 
     replay_enable(fname, mode);
+
+    loc_pop(&loc);
 }
 
 void replay_start(void)