am f9dd42de: Merge "Don\'t abort on read_file if the file is missing." into klp-dev
* commit 'f9dd42de6034ab09f9fa649ed1fbea25bc05e598': Don't abort on read_file if the file is missing.
This commit is contained in:
+3
-5
@@ -1271,7 +1271,6 @@ Value* Sha1CheckFn(const char* name, State* state, int argc, Expr* argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args[0]->size < 0) {
|
if (args[0]->size < 0) {
|
||||||
printf("%s(): no file contents received", name);
|
|
||||||
return StringValue(strdup(""));
|
return StringValue(strdup(""));
|
||||||
}
|
}
|
||||||
uint8_t digest[SHA_DIGEST_SIZE];
|
uint8_t digest[SHA_DIGEST_SIZE];
|
||||||
@@ -1324,12 +1323,11 @@ Value* ReadFileFn(const char* name, State* state, int argc, Expr* argv[]) {
|
|||||||
|
|
||||||
FileContents fc;
|
FileContents fc;
|
||||||
if (LoadFileContents(filename, &fc, RETOUCH_DONT_MASK) != 0) {
|
if (LoadFileContents(filename, &fc, RETOUCH_DONT_MASK) != 0) {
|
||||||
ErrorAbort(state, "%s() loading \"%s\" failed: %s",
|
|
||||||
name, filename, strerror(errno));
|
|
||||||
free(filename);
|
free(filename);
|
||||||
free(v);
|
v->size = -1;
|
||||||
|
v->data = NULL;
|
||||||
free(fc.data);
|
free(fc.data);
|
||||||
return NULL;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
v->size = fc.size;
|
v->size = fc.size;
|
||||||
|
|||||||
Reference in New Issue
Block a user