coccinelle: make use of SYNTHETIC_ERRNO
Ideally, coccinelle would strip unnecessary braces too. But I do not see any option in coccinelle for this, so instead, I edited the patch text using search&replace to remove the braces. Unfortunately this is not fully automatic, in particular it didn't deal well with if-else-if-else blocks and ifdefs, so there is an increased likelikehood be some bugs in such spots. I also removed part of the patch that coccinelle generated for udev, where we returns -1 for failure. This should be fixed independently.
This commit is contained in:
@@ -338,10 +338,9 @@ static int verify_one(PullJob *checksum_job, PullJob *job) {
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
|
||||
if (!filename_is_valid(fn)) {
|
||||
log_error("Cannot verify checksum, could not determine server-side file name.");
|
||||
return -EBADMSG;
|
||||
}
|
||||
if (!filename_is_valid(fn))
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EBADMSG),
|
||||
"Cannot verify checksum, could not determine server-side file name.");
|
||||
|
||||
line = strjoina(job->checksum, " *", fn, "\n");
|
||||
|
||||
@@ -359,10 +358,9 @@ static int verify_one(PullJob *checksum_job, PullJob *job) {
|
||||
strlen(line));
|
||||
}
|
||||
|
||||
if (!p || (p != (char*) checksum_job->payload && p[-1] != '\n')) {
|
||||
log_error("DOWNLOAD INVALID: Checksum of %s file did not checkout, file has been tampered with.", fn);
|
||||
return -EBADMSG;
|
||||
}
|
||||
if (!p || (p != (char*) checksum_job->payload && p[-1] != '\n'))
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EBADMSG),
|
||||
"DOWNLOAD INVALID: Checksum of %s file did not checkout, file has been tampered with.", fn);
|
||||
|
||||
log_info("SHA256 checksum of %s is valid.", job->url);
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user