diff --git a/src/local.c b/src/local.c index a56a9a3..04503eb 100644 --- a/src/local.c +++ b/src/local.c @@ -30,6 +30,7 @@ #include "image.h" static enum device device = DEVICE_UNKNOWN; +static int failed; int local_init(void) { @@ -38,10 +39,15 @@ int local_init(void) { char * ptr2; FILE * file; - file = fopen("/proc/cpuinfo", "r"); - if (!file) + if ( failed ) return -1; + file = fopen("/proc/cpuinfo", "r"); + if ( ! file ) { + failed = 1; + return -1; + } + while ( fgets(buf, sizeof(buf), file) ) { if ( strncmp(buf, "Hardware", strlen("Hardware")) == 0 ) { @@ -100,6 +106,7 @@ int local_init(void) { } + failed = 1; printf("Not a local device\n"); fclose(file); return -1;