|
|
|
@ -41,10 +41,9 @@ char *file_contents(const char *filename, int *length)
@@ -41,10 +41,9 @@ char *file_contents(const char *filename, int *length)
|
|
|
|
|
void *buffer; |
|
|
|
|
FILE *f; |
|
|
|
|
|
|
|
|
|
/* Try in the optional kernel path first, defaults to PREFIX */ |
|
|
|
|
strcpy(fullpath, opt_kernel_path); |
|
|
|
|
strcat(fullpath, filename); |
|
|
|
|
|
|
|
|
|
/* Try in the optional kernel path or installed prefix first */ |
|
|
|
|
f = fopen(fullpath, "rb"); |
|
|
|
|
if (!f) { |
|
|
|
|
/* Then try from the path sgminer was called */ |
|
|
|
@ -52,12 +51,20 @@ char *file_contents(const char *filename, int *length)
@@ -52,12 +51,20 @@ char *file_contents(const char *filename, int *length)
|
|
|
|
|
strcat(fullpath, filename); |
|
|
|
|
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 */ |
|
|
|
|
if (!f) |
|
|
|
|
f = fopen(filename, "rb"); |
|
|
|
|
|
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|