Commit a2915aa4 authored by Milosz Malczak's avatar Milosz Malczak Committed by Dimitris Lampridis

sw: Changed function to hadle errors to the one from the official API

parent 40b7a10a
...@@ -604,6 +604,7 @@ static enum wrtd_status wrtd_cmd_add_rule(struct wrtd_dev *wrtd, ...@@ -604,6 +604,7 @@ static enum wrtd_status wrtd_cmd_add_rule(struct wrtd_dev *wrtd,
status = wrtd_add_rule(wrtd, id); status = wrtd_add_rule(wrtd, id);
WRTD_RETURN_IF_ERROR(status); WRTD_RETURN_IF_ERROR(status);
return WRTD_SUCCESS; return WRTD_SUCCESS;
} }
...@@ -886,6 +887,8 @@ int main(int argc, char *argv[]) ...@@ -886,6 +887,8 @@ int main(int argc, char *argv[])
char *cmd = NULL; char *cmd = NULL;
char c; char c;
int i; int i;
char error_description[256];
enum wrtd_status error_code;
while ((c = getopt (argc, argv, "+hD:c:")) != -1) { while ((c = getopt (argc, argv, "+hD:c:")) != -1) {
switch (c) { switch (c) {
...@@ -926,9 +929,10 @@ int main(int argc, char *argv[]) ...@@ -926,9 +929,10 @@ int main(int argc, char *argv[])
status = cmds[i].handler(wrtd, argc - optind, argv + optind); status = cmds[i].handler(wrtd, argc - optind, argv + optind);
if (status != WRTD_SUCCESS) { if (status != WRTD_SUCCESS) {
wrtd_get_error(wrtd, &error_code, 256, error_description);
fprintf(stderr, fprintf(stderr,
"Error while executing command '%s': %s\n", "Error while executing command '%s': %s\n",
cmd, wrtd_get_error_msg(wrtd)); cmd, error_description);
} }
wrtd_close(wrtd); wrtd_close(wrtd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment