diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2009-08-12 19:21:01 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2009-08-12 19:21:01 +0000 |
commit | bf457f35a818448107aad560336df671755e589d (patch) | |
tree | bfa21efd31af7271177c8e2b3e63ec2c6fd75995 /xpp/astribank_tool.c | |
parent | 6c67be02ffa70bc95357fd6b311ea7fbcdb8f6aa (diff) |
xpp: cleanup gcc warnings and one real astribank_tool bug
xpp rev: 7281
git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@6976 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'xpp/astribank_tool.c')
-rw-r--r-- | xpp/astribank_tool.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/xpp/astribank_tool.c b/xpp/astribank_tool.c index b9bcaaa..caee860 100644 --- a/xpp/astribank_tool.c +++ b/xpp/astribank_tool.c @@ -150,8 +150,6 @@ int main(int argc, char *argv[]) char *opt_port = NULL; char *opt_watchdog = NULL; char *opt_reset = NULL; - int tws_portnum; - int full_reset; int ret; progname = argv[0]; @@ -177,7 +175,11 @@ int main(int argc, char *argv[]) break; case 'r': opt_reset = optarg; - if((full_reset = reset_kind(opt_reset)) < 0) + /* + * Sanity check so we can reject bad + * arguments before device access. + */ + if(reset_kind(opt_reset) < 0) usage(); break; case 'v': @@ -213,6 +215,12 @@ int main(int argc, char *argv[]) } show_hardware(astribank); if(opt_reset) { + int full_reset; + + if((full_reset = reset_kind(opt_reset)) < 0) { + ERR("Bad reset kind '%s'\n", opt_reset); + return 1; + } if((ret = mpp_reset(astribank, full_reset)) < 0) { ERR("%s Reseting astribank failed: %d\n", (full_reset) ? "Full" : "Half", ret); @@ -232,6 +240,7 @@ int main(int argc, char *argv[]) } } else if(opt_port) { int new_portnum = strtoul(opt_port, NULL, 0); + int tws_portnum = mpp_tws_portnum(astribank); char *msg = (new_portnum == tws_portnum) ? " Same same, never mind..." : ""; |