diff options
-rw-r--r-- | intelgpio.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/intelgpio.c b/intelgpio.c index 573f6b7..46d0e7d 100644 --- a/intelgpio.c +++ b/intelgpio.c @@ -73,9 +73,14 @@ int main(int argc, char *argv[]) } fseek(f, GPIO_BASE, SEEK_SET); - fread(&base, 2, 1, f); + size_t readed = fread(&base, 2, 1, f); fclose(f); + if (readed < 1) { + fprintf(stderr, "error: readed %lu bytes\n", readed); + return 1; + } + base &= 0xfffe; if (ioperm(base, 0x100, 1)) { |