-/* $OpenBSD: main.c,v 1.111 2021/03/04 14:16:21 tb Exp $ */
+/* $OpenBSD: main.c,v 1.112 2021/03/04 14:24:17 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
struct entity *p;
if ((p = calloc(1, sizeof(struct entity))) == NULL)
- err(1, "calloc");
+ err(1, NULL);
p->type = type;
p->file = file;
if (p->has_pkey) {
p->pkeysz = pkeysz;
if ((p->pkey = malloc(pkeysz)) == NULL)
- err(1, "malloc");
+ err(1, NULL);
memcpy(p->pkey, pkey, pkeysz);
}
if (descr != NULL)
if ((p->descr = strdup(descr)) == NULL)
- err(1, "strdup");
+ err(1, NULL);
filepath_add(file);
rt.repos = recallocarray(rt.repos, rt.reposz, rt.reposz + 1,
sizeof(struct repo));
if (rt.repos == NULL)
- err(1, "recallocarray");
+ err(1, NULL);
rp = &rt.repos[rt.reposz++];
rp->id = rt.reposz - 1;
size_t i, j;
if (asprintf(&local, "ta/%s", tal->descr) == -1)
- err(1, "asprinf");
+ err(1, NULL);
/* Look up in repository table. (Lookup should actually fail here) */
for (i = 0; i < rt.reposz; i++) {
rp->local = local;
for (i = 0, j = 0; i < tal->urisz && j < 2; i++) {
if ((rp->uris[j++] = strdup(tal->uri[i])) == NULL)
- err(1, "strdup");
+ err(1, NULL);
}
if (j == 0)
errx(1, "TAL %s has no URI", tal->descr);
rp = repo_alloc();
rp->repouri = repo;
local = strchr(repo, ':') + strlen("://");
- if (asprintf(&rp->local, "rsync/%s", local) == -1)
- err(1, "asprintf");
+ if ((rp->local = strdup(repo)) == NULL)
+ err(1, NULL);
if ((rp->uris[0] = strdup(repo)) == NULL)
- err(1, "strdup");
+ err(1, NULL);
repo_fetch(rp);
return rp;
if (asprintf(&nfile, "%s%s%s", repo->local, file,
temp ? ".XXXXXXXX": "") == -1)
- err(1, "asprintf");
+ err(1, NULL);
return nfile;
}
uri += strlen(repo->repouri) + 1; /* skip base and '/' */
if (asprintf(&nfile, "%s/%s", repo->local, uri) == -1)
- err(1, "asprintf");
+ err(1, NULL);
return nfile;
}
assert(cp != NULL);
assert(cp - mft < INT_MAX);
if (asprintf(&nfile, "%.*s/%s", (int)(cp - mft), mft, file->file) == -1)
- err(1, "asprintf");
+ err(1, NULL);
/*
* Since we're from the same directory as the MFT file, we know
char *nfile, *buf;
if ((nfile = strdup(file)) == NULL)
- err(1, "strdup");
+ err(1, NULL);
buf = tal_read_file(file);
/* Record tal for later reporting */
else {
char *tmp;
if (asprintf(&tmp, "%s %s", stats.talnames, file) == -1)
- err(1, "asprintf");
+ err(1, NULL);
free(stats.talnames);
stats.talnames = tmp;
}
err(1, "too many tal files found in %s",
confdir);
if (asprintf(&path, "%s/%s", confdir, dp->d_name) == -1)
- err(1, "asprintf");
+ err(1, NULL);
tals[s++] = path;
}
closedir (dirp);
del = reallocarray(del, i + 1, sizeof(*del));
if (del == NULL)
- err(1, "reallocarray");
- del[i] = strdup(file);
- if (del[i] == NULL)
- err(1, "strdup");
+ err(1, NULL);
+ if ((del[i] = strdup(file)) == NULL)
+ err(1, NULL);
*dsz = i + 1;
return del;
}
-/* $OpenBSD: mft.c,v 1.27 2021/02/19 12:18:23 tb Exp $ */
+/* $OpenBSD: mft.c,v 1.28 2021/03/04 14:24:17 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
assert(cp != NULL);
assert(cp - fn < INT_MAX);
if (asprintf(&path, "%.*s/%s", (int)(cp - fn), fn, m->file) == -1)
- err(1, "asprintf");
+ err(1, NULL);
if ((fd = open(path, O_RDONLY)) == -1) {
warn("%s: referenced file %s", fn, m->file);
-/* $OpenBSD: rsync.c,v 1.20 2021/03/04 14:02:34 claudio Exp $ */
+/* $OpenBSD: rsync.c,v 1.21 2021/03/04 14:24:17 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
if (getenv("PATH") == NULL)
errx(1, "PATH is unset");
if ((path = strdup(getenv("PATH"))) == NULL)
- err(1, "strdup");
+ err(1, NULL);
save = path;
while ((pp = strsep(&path, ":")) != NULL) {
if (*pp == '\0')
continue;
if (asprintf(&cmd, "%s/%s", pp, prog) == -1)
- err(1, "asprintf");
+ err(1, NULL);
if (lstat(cmd, &stt) == -1) {
free(cmd);
continue;