-/* $Id: fargs.c,v 1.17 2019/05/08 20:00:25 benno Exp $ */
+/* $Id: fargs.c,v 1.18 2021/05/17 12:02:58 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
#include <sys/stat.h>
#include <assert.h>
+#include <err.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
if (sess->opts->ssh_prog) {
ap = strdup(sess->opts->ssh_prog);
if (ap == NULL)
- goto out;
+ err(ERR_NOMEM, NULL);
while ((arg = strsep(&ap, " \t")) != NULL) {
if (arg[0] == '\0') {
addargs(&args, "%s", f->sink);
return args.list;
-out:
- freeargs(&args);
- ERR("calloc");
- return NULL;
}
-/* $OpenBSD: misc.c,v 1.2 2021/03/22 11:14:42 claudio Exp $ */
+/* $OpenBSD: misc.c,v 1.3 2021/05/17 12:02:58 claudio Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005,2006 Damien Miller. All rights reserved.
r = vasprintf(&cp, fmt, ap);
va_end(ap);
if (r == -1)
- err(1, "addargs: argument too long");
+ err(ERR_NOMEM, "addargs: argument too long");
nalloc = args->nalloc;
if (args->list == NULL) {
} else if (args->num+2 >= nalloc)
nalloc *= 2;
- args->list = recallocarray(args->list, args->nalloc, nalloc, sizeof(char *));
+ args->list = recallocarray(args->list, args->nalloc, nalloc,
+ sizeof(char *));
if (!args->list)
- err(1, "malloc");
+ err(ERR_NOMEM, NULL);
args->nalloc = nalloc;
args->list[args->num++] = cp;
args->list[args->num] = NULL;
-/* $Id: socket.c,v 1.29 2021/03/31 19:45:16 job Exp $ */
+/* $Id: socket.c,v 1.30 2021/05/17 12:02:58 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
if (pledge("stdio unix rpath wpath cpath dpath inet fattr chown dns getpw unveil",
NULL) == -1)
- err(1, "pledge");
+ err(ERR_IPC, "pledge");
memset(&sess, 0, sizeof(struct sess));
sess.opts = opts;
if (pledge("stdio unix rpath wpath cpath dpath fattr chown getpw unveil",
NULL) == -1)
- err(1, "pledge");
+ err(ERR_IPC, "pledge");
memset(&sess, 0, sizeof(struct sess));
sess.lver = RSYNC_PROTOCOL;
assert(f->host != NULL);
assert(f->module != NULL);
- if ((args = fargs_cmdline(&sess, f, &skip)) == NULL) {
- ERRX1("fargs_cmdline");
- exit(1);
- }
+ args = fargs_cmdline(&sess, f, &skip);
/* Initiate with the rsyncd version and module request. */