|
|
@ -41,10 +41,9 @@ char *file_contents(const char *filename, int *length) |
|
|
|
void *buffer; |
|
|
|
void *buffer; |
|
|
|
FILE *f; |
|
|
|
FILE *f; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Try in the optional kernel path first, defaults to PREFIX */ |
|
|
|
strcpy(fullpath, opt_kernel_path); |
|
|
|
strcpy(fullpath, opt_kernel_path); |
|
|
|
strcat(fullpath, filename); |
|
|
|
strcat(fullpath, filename); |
|
|
|
|
|
|
|
|
|
|
|
/* Try in the optional kernel path or installed prefix first */ |
|
|
|
|
|
|
|
f = fopen(fullpath, "rb"); |
|
|
|
f = fopen(fullpath, "rb"); |
|
|
|
if (!f) { |
|
|
|
if (!f) { |
|
|
|
/* Then try from the path sgminer was called */ |
|
|
|
/* Then try from the path sgminer was called */ |
|
|
@ -52,12 +51,20 @@ char *file_contents(const char *filename, int *length) |
|
|
|
strcat(fullpath, filename); |
|
|
|
strcat(fullpath, filename); |
|
|
|
f = fopen(fullpath, "rb"); |
|
|
|
f = fopen(fullpath, "rb"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!f) { |
|
|
|
|
|
|
|
/* Then from `pwd`/kernel/ */ |
|
|
|
|
|
|
|
strcpy(fullpath, sgminer_path); |
|
|
|
|
|
|
|
strcat(fullpath, "kernel/"); |
|
|
|
|
|
|
|
strcat(fullpath, filename); |
|
|
|
|
|
|
|
f = fopen(fullpath, "rb"); |
|
|
|
|
|
|
|
} |
|
|
|
/* Finally try opening it directly */ |
|
|
|
/* Finally try opening it directly */ |
|
|
|
if (!f) |
|
|
|
if (!f) |
|
|
|
f = fopen(filename, "rb"); |
|
|
|
f = fopen(filename, "rb"); |
|
|
|
|
|
|
|
|
|
|
|
if (!f) { |
|
|
|
if (!f) { |
|
|
|
applog(LOG_ERR, "Unable to open %s or %s for reading", filename, fullpath); |
|
|
|
applog(LOG_ERR, "Unable to open %s or %s for reading", |
|
|
|
|
|
|
|
filename, fullpath); |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|