summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-02-17 16:34:05 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-02-17 16:34:05 +0000
commita86e70d95b76261206a8597c27298f4fb9d9a53a (patch)
tree523015c0f3bcde5ad0b2eeb0b8803544c8330613 /usr.bin
parent46ed2474e5c31d08cd4bfd984c7798266b5f9b8b (diff)
more yoda repairs
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/rsync/blocks.c4
-rw-r--r--usr.bin/rsync/child.c4
-rw-r--r--usr.bin/rsync/downloader.c4
-rw-r--r--usr.bin/rsync/io.c4
-rw-r--r--usr.bin/rsync/log.c40
-rw-r--r--usr.bin/rsync/receiver.c6
-rw-r--r--usr.bin/rsync/sender.c12
-rw-r--r--usr.bin/rsync/socket.c8
-rw-r--r--usr.bin/rsync/uploader.c8
9 files changed, 45 insertions, 45 deletions
diff --git a/usr.bin/rsync/blocks.c b/usr.bin/rsync/blocks.c
index 5ba80469634..bdd880fc11c 100644
--- a/usr.bin/rsync/blocks.c
+++ b/usr.bin/rsync/blocks.c
@@ -1,4 +1,4 @@
-/* $Id: blocks.c,v 1.9 2019/02/16 16:58:39 florian Exp $ */
+/* $Id: blocks.c,v 1.10 2019/02/17 16:34:04 deraadt Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -168,7 +168,7 @@ blk_match(struct sess *sess, const struct blkset *blks,
st->curpos = last;
st->curlen = st->curpos + sz;
st->curtok = tok;
- assert(0 != st->curtok);
+ assert(st->curtok != 0);
st->curst = sz ? BLKSTAT_DATA : BLKSTAT_TOK;
st->total += blk->len;
st->offs += blk->len;
diff --git a/usr.bin/rsync/child.c b/usr.bin/rsync/child.c
index 959baba8f96..04a7b14ecbd 100644
--- a/usr.bin/rsync/child.c
+++ b/usr.bin/rsync/child.c
@@ -1,4 +1,4 @@
-/* $Id: child.c,v 1.3 2019/02/11 21:41:22 deraadt Exp $ */
+/* $Id: child.c,v 1.4 2019/02/17 16:34:04 deraadt Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -49,7 +49,7 @@ rsync_child(const struct opts *opts, int fd, const struct fargs *f)
exit(EXIT_FAILURE);
}
- for (i = 0; NULL != args[i]; i++)
+ for (i = 0; args[i] != NULL; i++)
LOG2(&sess, "exec[%zu] = %s", i, args[i]);
/* Make sure the child's stdin is from the sender. */
diff --git a/usr.bin/rsync/downloader.c b/usr.bin/rsync/downloader.c
index 1de0e92375d..0ddc1b488d0 100644
--- a/usr.bin/rsync/downloader.c
+++ b/usr.bin/rsync/downloader.c
@@ -1,4 +1,4 @@
-/* $Id: downloader.c,v 1.13 2019/02/16 16:56:33 florian Exp $ */
+/* $Id: downloader.c,v 1.14 2019/02/17 16:34:04 deraadt Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -85,7 +85,7 @@ log_file(struct sess *sess,
if (sess->opts->server)
return;
- frac = 0 == dl->total ? 100.0 :
+ frac = (dl->total == 0) ? 100.0 :
100.0 * dl->downloaded / dl->total;
if (dl->total > 1024 * 1024 * 1024) {
diff --git a/usr.bin/rsync/io.c b/usr.bin/rsync/io.c
index a8dce4d7d2a..018798bed83 100644
--- a/usr.bin/rsync/io.c
+++ b/usr.bin/rsync/io.c
@@ -1,4 +1,4 @@
-/* $Id: io.c,v 1.8 2019/02/16 16:58:39 florian Exp $ */
+/* $Id: io.c,v 1.9 2019/02/17 16:34:04 deraadt Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -464,7 +464,7 @@ io_lowbuffer_buf(struct sess *sess, void *buf,
{
int32_t tagbuf;
- if (0 == valsz)
+ if (valsz == 0)
return;
if (!sess->mplex_writes) {
diff --git a/usr.bin/rsync/log.c b/usr.bin/rsync/log.c
index 08284fc83d2..606996b8c23 100644
--- a/usr.bin/rsync/log.c
+++ b/usr.bin/rsync/log.c
@@ -1,4 +1,4 @@
-/* $Id: log.c,v 1.2 2019/02/10 23:24:14 benno Exp $ */
+/* $Id: log.c,v 1.3 2019/02/17 16:34:04 deraadt Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -38,7 +38,7 @@ rsync_log(struct sess *sess, const char *fname,
if (sess->opts->verbose < level + 1)
return;
- if (NULL != fmt) {
+ if (fmt != NULL) {
va_start(ap, fmt);
if (vasprintf(&buf, fmt, ap) < 0) {
va_end(ap);
@@ -47,12 +47,12 @@ rsync_log(struct sess *sess, const char *fname,
va_end(ap);
}
- if (level <= 0 && NULL != buf)
+ if (level <= 0 && buf != NULL)
fprintf(stderr, "%s\n", buf);
else if (level > 0)
fprintf(stderr, "%s:%zu%s%s\n", fname, line,
- NULL != buf ? ": " : "",
- NULL != buf ? buf : "");
+ (buf != NULL) ? ": " : "",
+ (buf != NULL) ? buf : "");
free(buf);
}
@@ -67,7 +67,7 @@ rsync_errx(struct sess *sess, const char *fname,
char *buf = NULL;
va_list ap;
- if (NULL != fmt) {
+ if (fmt != NULL) {
va_start(ap, fmt);
if (vasprintf(&buf, fmt, ap) < 0) {
va_end(ap);
@@ -77,8 +77,8 @@ rsync_errx(struct sess *sess, const char *fname,
}
fprintf(stderr, "%s:%zu: error%s%s\n", fname, line,
- NULL != buf ? ": " : "",
- NULL != buf ? buf : "");
+ buf != NULL ? ": " : "",
+ buf != NULL ? buf : "");
free(buf);
}
@@ -94,7 +94,7 @@ rsync_err(struct sess *sess, const char *fname,
va_list ap;
int er = errno;
- if (NULL != fmt) {
+ if (fmt != NULL) {
va_start(ap, fmt);
if (vasprintf(&buf, fmt, ap) < 0) {
va_end(ap);
@@ -104,8 +104,8 @@ rsync_err(struct sess *sess, const char *fname,
}
fprintf(stderr, "%s:%zu: error%s%s: %s\n", fname, line,
- NULL != buf ? ": " : "",
- NULL != buf ? buf : "", strerror(er));
+ buf != NULL ? ": " : "",
+ buf != NULL ? buf : "", strerror(er));
free(buf);
}
@@ -123,7 +123,7 @@ rsync_errx1(struct sess *sess, const char *fname,
if (sess->opts->verbose < 1)
return;
- if (NULL != fmt) {
+ if (fmt != NULL) {
va_start(ap, fmt);
if (vasprintf(&buf, fmt, ap) < 0) {
va_end(ap);
@@ -133,8 +133,8 @@ rsync_errx1(struct sess *sess, const char *fname,
}
fprintf(stderr, "%s:%zu: error%s%s\n", fname, line,
- NULL != buf ? ": " : "",
- NULL != buf ? buf : "");
+ buf != NULL ? ": " : "",
+ buf != NULL ? buf : "");
free(buf);
}
@@ -148,7 +148,7 @@ rsync_warnx(struct sess *sess, const char *fname,
char *buf = NULL;
va_list ap;
- if (NULL != fmt) {
+ if (fmt != NULL) {
va_start(ap, fmt);
if (vasprintf(&buf, fmt, ap) < 0) {
va_end(ap);
@@ -158,8 +158,8 @@ rsync_warnx(struct sess *sess, const char *fname,
}
fprintf(stderr, "%s:%zu: warning%s%s\n", fname, line,
- NULL != buf ? ": " : "",
- NULL != buf ? buf : "");
+ buf != NULL ? ": " : "",
+ buf != NULL ? buf : "");
free(buf);
}
@@ -178,7 +178,7 @@ rsync_warn(struct sess *sess, int level,
if (sess->opts->verbose < level)
return;
- if (NULL != fmt) {
+ if (fmt != NULL) {
va_start(ap, fmt);
if (vasprintf(&buf, fmt, ap) < 0) {
va_end(ap);
@@ -188,7 +188,7 @@ rsync_warn(struct sess *sess, int level,
}
fprintf(stderr, "%s:%zu: warning%s%s: %s\n", fname, line,
- NULL != buf ? ": " : "",
- NULL != buf ? buf : "", strerror(er));
+ buf != NULL ? ": " : "",
+ buf != NULL ? buf : "", strerror(er));
free(buf);
}
diff --git a/usr.bin/rsync/receiver.c b/usr.bin/rsync/receiver.c
index 998c3e110a7..02ba0810fc8 100644
--- a/usr.bin/rsync/receiver.c
+++ b/usr.bin/rsync/receiver.c
@@ -1,4 +1,4 @@
-/* $Id: receiver.c,v 1.16 2019/02/16 16:57:17 florian Exp $ */
+/* $Id: receiver.c,v 1.17 2019/02/17 16:34:04 deraadt Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -199,7 +199,7 @@ rsync_receiver(struct sess *sess, int fdin, int fdout, const char *root)
if (!io_read_size(sess, fdin, &excl)) {
ERRX1(sess, "io_read_size");
goto out;
- } else if (0 != excl) {
+ } else if (excl != 0) {
ERRX(sess, "exclusion list is non-empty");
goto out;
}
@@ -220,7 +220,7 @@ rsync_receiver(struct sess *sess, int fdin, int fdout, const char *root)
if (!io_read_int(sess, fdin, &ioerror)) {
ERRX1(sess, "io_read_int");
goto out;
- } else if (0 != ioerror) {
+ } else if (ioerror != 0) {
ERRX1(sess, "io_error is non-zero");
goto out;
}
diff --git a/usr.bin/rsync/sender.c b/usr.bin/rsync/sender.c
index 252345fd980..d42d3a1a342 100644
--- a/usr.bin/rsync/sender.c
+++ b/usr.bin/rsync/sender.c
@@ -1,4 +1,4 @@
-/* $Id: sender.c,v 1.12 2019/02/16 23:16:54 deraadt Exp $ */
+/* $Id: sender.c,v 1.13 2019/02/17 16:34:04 deraadt Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -59,7 +59,7 @@ static void
send_up_reset(struct send_up *p)
{
- assert(NULL != p);
+ assert(p != NULL);
/* Free the download request, if applicable. */
@@ -386,7 +386,7 @@ rsync_sender(struct sess *sess, int fdin,
if (pfd[1].revents & POLLOUT) {
assert(pfd[2].fd == -1);
- assert(0 == wbufpos && 0 == wbufsz);
+ assert(wbufpos == 0 && wbufsz == 0);
/*
* If we have data to write, do it now according
@@ -476,7 +476,7 @@ rsync_sender(struct sess *sess, int fdin,
(intmax_t)up.stat.total / 1024,
100.0 * up.stat.dirty / up.stat.total);
send_up_reset(&up);
- } else if (NULL != up.cur && up.cur->idx < 0) {
+ } else if (up.cur != NULL && up.cur->idx < 0) {
/*
* We've hit the phase change following
* the last file (or start, or prior
@@ -504,7 +504,7 @@ rsync_sender(struct sess *sess, int fdin,
if (phase++)
break;
- } else if (NULL != up.cur && 0 == up.primed) {
+ } else if (up.cur != NULL && up.primed == 0) {
/*
* We're getting ready to send the file
* contents to the receiver.
@@ -534,7 +534,7 @@ rsync_sender(struct sess *sess, int fdin,
fl[up.cur->idx].path,
(intmax_t)up.cur->blks->size);
up.primed = 1;
- } else if (NULL != up.cur) {
+ } else if (up.cur != NULL) {
/*
* Our last case: we need to find the
* next block (and token) to transmit to
diff --git a/usr.bin/rsync/socket.c b/usr.bin/rsync/socket.c
index 8cc0a305645..c0e2e3c0407 100644
--- a/usr.bin/rsync/socket.c
+++ b/usr.bin/rsync/socket.c
@@ -1,4 +1,4 @@
-/* $Id: socket.c,v 1.13 2019/02/17 15:59:09 deraadt Exp $ */
+/* $Id: socket.c,v 1.14 2019/02/17 16:34:04 deraadt Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -135,7 +135,7 @@ inet_resolve(struct sess *sess, const char *host, size_t *sz)
/* Allocate for all available addresses. */
- for (res = res0; NULL != res; res = res->ai_next)
+ for (res = res0; res != NULL; res = res->ai_next)
if (res->ai_family == AF_INET ||
res->ai_family == AF_INET6)
srcsz++;
@@ -153,7 +153,7 @@ inet_resolve(struct sess *sess, const char *host, size_t *sz)
return NULL;
}
- for (i = 0, res = res0; NULL != res; res = res->ai_next) {
+ for (i = 0, res = res0; res != NULL; res = res->ai_next) {
if (res->ai_family != AF_INET &&
res->ai_family != AF_INET6)
continue;
@@ -371,7 +371,7 @@ rsync_socket(const struct opts *opts, const struct fargs *f)
else
i = 1; /* rsync... */
- for ( ; NULL != args[i]; i++)
+ for ( ; args[i] != NULL; i++)
if (!io_write_line(&sess, sd, args[i])) {
ERRX1(&sess, "io_write_line");
goto out;
diff --git a/usr.bin/rsync/uploader.c b/usr.bin/rsync/uploader.c
index 878b9a35c9e..6f7c6dbd509 100644
--- a/usr.bin/rsync/uploader.c
+++ b/usr.bin/rsync/uploader.c
@@ -1,4 +1,4 @@
-/* $Id: uploader.c,v 1.13 2019/02/16 16:56:33 florian Exp $ */
+/* $Id: uploader.c,v 1.14 2019/02/17 16:34:04 deraadt Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2019 Florian Obser <florian@openbsd.org>
@@ -732,7 +732,7 @@ rsync_uploader(struct upload *u, int *fileinfd,
*/
if (u->state == UPLOAD_WRITE_LOCAL) {
- assert(NULL != u->buf);
+ assert(u->buf != NULL);
assert(*fileoutfd != -1);
assert(*fileinfd == -1);
@@ -823,8 +823,8 @@ rsync_uploader(struct upload *u, int *fileinfd,
/* Go back to the event loop, if necessary. */
- u->state = -1 == *fileinfd ?
- UPLOAD_WRITE_LOCAL : UPLOAD_READ_LOCAL;
+ u->state = (*fileinfd == -1) ?
+ UPLOAD_WRITE_LOCAL : UPLOAD_READ_LOCAL;
if (u->state == UPLOAD_READ_LOCAL)
return 1;
}