summaryrefslogtreecommitdiffstats
path: root/src/local.c
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2012-11-21 14:14:21 +0100
committerPali Rohár <pali.rohar@gmail.com>2012-11-21 14:14:21 +0100
commit288726981a158c894c223fa762b71baadd89e467 (patch)
tree0aa53e2b4100c2f42f26d0781bdaf1f97f9ac7e7 /src/local.c
parent8635ea66a72bf1f1283e31fc340137b55b93c6da (diff)
download0xFFFF-288726981a158c894c223fa762b71baadd89e467.tar.bz2
local: Do not call local_init more times
Diffstat (limited to 'src/local.c')
-rw-r--r--src/local.c9
1 files changed, 8 insertions, 1 deletions
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,9 +39,14 @@ int local_init(void) {
char * ptr2;
FILE * file;
+ if ( failed )
+ return -1;
+
file = fopen("/proc/cpuinfo", "r");
- if (!file)
+ if ( ! file ) {
+ failed = 1;
return -1;
+ }
while ( fgets(buf, sizeof(buf), file) ) {
@@ -100,6 +106,7 @@ int local_init(void) {
}
+ failed = 1;
printf("Not a local device\n");
fclose(file);
return -1;