From 56502adbe56e0679b44b764454cd716bbc9c3cc3 Mon Sep 17 00:00:00 2001 From: Rutger Hofman Date: Wed, 13 May 2009 17:25:06 +0000 Subject: [PATCH] Fix scope/loop bug in src/cmd/cmd_svf.c git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1591 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/src/cmd/cmd_svf.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/urjtag/src/cmd/cmd_svf.c b/urjtag/src/cmd/cmd_svf.c index e03d8a17..ba0f665c 100644 --- a/urjtag/src/cmd/cmd_svf.c +++ b/urjtag/src/cmd/cmd_svf.c @@ -67,24 +67,31 @@ cmd_svf_run (urj_chain_t *chain, char *params[]) print_progress = 1; else if (strncasecmp (params[i], "ref_freq=", 9) == 0) ref_freq = strtol (params[i] + 9, NULL, 10); - if (print_progress) - urj_log_state.level = URJ_LOG_LEVEL_DETAIL; - - if ((SVF_FILE = fopen (params[1], "r")) != NULL) - { - if (! urj_svf_run (chain, SVF_FILE, stop, ref_freq)) - result = URJ_STATUS_FAIL; - - fclose (SVF_FILE); - } else { urj_error_set (URJ_ERROR_SYNTAX, "%s: unknown command '%s'", params[0], params[i]); - result = URJ_STATUS_FAIL; + return URJ_STATUS_FAIL; } } + if (print_progress) + urj_log_state.level = URJ_LOG_LEVEL_DETAIL; + + if ((SVF_FILE = fopen (params[1], "r")) != NULL) + { + if (! urj_svf_run (chain, SVF_FILE, stop, ref_freq)) + result = URJ_STATUS_FAIL; + + fclose (SVF_FILE); + } + else + { + urj_error_IO_set ("%s: cannot open file '%s'", + params[0], params[i]); + result = URJ_STATUS_FAIL; + } + urj_log_state.level = old_log_level; return result;