diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/jobs.c | 14 | ||||
-rw-r--r-- | src/util.c | 8 |
2 files changed, 15 insertions, 7 deletions
@@ -231,11 +231,11 @@ static int job_read_outputs(struct job *job, cJSON *outputs) /* for nix-eval-jobs output only, for dag use the htab instead */ struct job *job_search(struct job *job, const char *drv) { - if (strcmp(drv, job->drv_path)) + if (!strcmp(drv, job->drv_path)) return job; for (size_t i = 0; i < job->deps_filled; i++) { - if (strcmp(drv, job->deps[i]->drv_path)) + if (!strcmp(drv, job->deps[i]->drv_path)) return job->deps[i]; } @@ -274,10 +274,8 @@ static int job_read_cache(struct job *job) j = job_search(job, trim(line)); if (j == NULL) { - /* bug in nix-eval-jobs or nix-build */ - print_err("%s", "could not find job"); - ret = -ESRCH; - goto out_free_line; + /* nix-eval-jobs doesn't count src */ + continue; } if (in_fetched_block) @@ -297,9 +295,11 @@ static int job_read_cache(struct job *job) } /* remove stale deps */ - for (size_t i = 0; i < job->deps_filled; i++) { + for (size_t i = 0; i < job->deps_filled;) { if (job->deps[i]->stale) job_free(job->deps[i]); + else + i++; } out_free_line: @@ -142,8 +142,16 @@ int run(const char *file, char *argv[]) char *trim(char *s) { + size_t end, i; + while (isspace(*s)) s++; + for (i = 0, end = 0; s[i]; i++) { + if (isgraph(s[i])) + end = i + 1; + } + s[end] = '\0'; + return s; } |