1
0
mirror of https://github.com/xtacocorex/CHIP_IO synced 2025-07-20 04:43:21 +00:00

Testing and error handling

This commit is contained in:
fordsfords
2016-07-04 14:35:45 -05:00
parent 0e7d03c472
commit 694aa37f23
3 changed files with 54 additions and 42 deletions

View File

@ -193,7 +193,7 @@ int get_xio_base(void)
snprintf(base_file, sizeof(base_file), "%s/%s/base", GPIO_PATH, ent->d_name); BUF2SMALL(base_file);
base_fp = fopen(base_file, "r");
if (base_fp == NULL) {
char err[80];
char err[256];
snprintf(err, sizeof(err), "get_xio_base: could not open '%s' (%s)", base_file, strerror(errno));
add_error_msg(err);
break; /* error, exit loop */
@ -201,7 +201,7 @@ int get_xio_base(void)
s = fgets(input_line, sizeof(input_line), base_fp); BUF2SMALL(input_line);
fclose(base_fp);
if (s == NULL) {
char err[80];
char err[256];
snprintf(err, sizeof(err), "get_xio_base: could not read '%s' (%s)", base_file, strerror(errno));
add_error_msg(err);
break; /* error, exit loop */
@ -231,7 +231,7 @@ int gpio_number(pins_t *pin)
case BASE_METHOD_XIO:
xio_base = get_xio_base();
if (xio_base <= 0) {
char err[80]; snprintf(err, sizeof(err), "gpio_number: %d found for %s", xio_base, pin->name);
char err[256]; snprintf(err, sizeof(err), "gpio_number: %d found for %s", xio_base, pin->name);
add_error_msg(err);
break; /* error, exit switch */
}