diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-02-11 19:18:37 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-02-11 19:18:37 +0000 |
commit | c9cd7b2c9052281e113a2d896ed28a84b410b744 (patch) | |
tree | c6eefaebc0baf7fcc4738513a20e12867073b1a3 | |
parent | 3d65e35cc2a52aa1325eba38ab8cb0290c88c1d8 (diff) |
cleanup weird spaces around !. (We normalize source-code to a standard
idiom because it is less error prone for a larger team. kristaps idiom
is highly divergent)
ok benno
-rw-r--r-- | usr.bin/rsync/blocks.c | 58 | ||||
-rw-r--r-- | usr.bin/rsync/client.c | 12 | ||||
-rw-r--r-- | usr.bin/rsync/downloader.c | 22 | ||||
-rw-r--r-- | usr.bin/rsync/flist.c | 92 | ||||
-rw-r--r-- | usr.bin/rsync/io.c | 50 | ||||
-rw-r--r-- | usr.bin/rsync/main.c | 14 | ||||
-rw-r--r-- | usr.bin/rsync/receiver.c | 36 | ||||
-rw-r--r-- | usr.bin/rsync/sender.c | 36 | ||||
-rw-r--r-- | usr.bin/rsync/server.c | 16 | ||||
-rw-r--r-- | usr.bin/rsync/session.c | 14 | ||||
-rw-r--r-- | usr.bin/rsync/socket.c | 16 | ||||
-rw-r--r-- | usr.bin/rsync/uploader.c | 30 |
12 files changed, 198 insertions, 198 deletions
diff --git a/usr.bin/rsync/blocks.c b/usr.bin/rsync/blocks.c index 6f1d8d2fb6f..4de8783bfea 100644 --- a/usr.bin/rsync/blocks.c +++ b/usr.bin/rsync/blocks.c @@ -1,4 +1,4 @@ -/* $Id: blocks.c,v 1.2 2019/02/10 23:24:14 benno Exp $ */ +/* $Id: blocks.c,v 1.3 2019/02/11 19:18:36 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -45,17 +45,17 @@ blk_flush(struct sess *sess, int fd, while (i < size) { sz = MAX_CHUNK < (size - i) ? MAX_CHUNK : (size - i); - if ( ! io_write_int(sess, fd, sz)) { + if (!io_write_int(sess, fd, sz)) { ERRX1(sess, "io_write_int"); return 0; - } else if ( ! io_write_buf(sess, fd, b + i, sz)) { + } else if (!io_write_buf(sess, fd, b + i, sz)) { ERRX1(sess, "io_write_buf"); return 0; } i += sz; } - if ( ! io_write_int(sess, fd, token)) { + if (!io_write_int(sess, fd, token)) { ERRX1(sess, "io_write_int"); return 0; } @@ -198,7 +198,7 @@ blk_match_send(struct sess *sess, const char *path, int fd, * it already has in the matching block. */ - if ( ! blk_flush(sess, fd, buf + last, sz, tok)) { + if (!blk_flush(sess, fd, buf + last, sz, tok)) { ERRX1(sess, "blk_flush"); return 0; } @@ -218,7 +218,7 @@ blk_match_send(struct sess *sess, const char *path, int fd, LOG4(sess, "%s: flushing remaining %jd B", path, (intmax_t)sz); - if ( ! blk_flush(sess, fd, buf + last, sz, 0)) { + if (!blk_flush(sess, fd, buf + last, sz, 0)) { ERRX1(sess, "blk_flush"); return 0; } @@ -280,12 +280,12 @@ blk_match(struct sess *sess, int fd, if (st.st_size && blks->blksz) { c = blk_match_send(sess, path, fd, map, st.st_size, blks); - if ( ! c) { + if (!c) { ERRX1(sess, "blk_match_send"); goto out; } } else { - if ( ! blk_flush(sess, fd, map, st.st_size, 0)) { + if (!blk_flush(sess, fd, map, st.st_size, 0)) { ERRX1(sess, "blk_flush"); return 0; } @@ -301,7 +301,7 @@ blk_match(struct sess *sess, int fd, hash_file(map, st.st_size, filemd, sess); - if ( ! io_write_buf(sess, fd, filemd, MD4_DIGEST_LENGTH)) { + if (!io_write_buf(sess, fd, filemd, MD4_DIGEST_LENGTH)) { ERRX1(sess, "io_write_buf"); goto out; } @@ -338,15 +338,15 @@ blk_recv_ack(struct sess *sess, /* FIXME: put into static block. */ - if ( ! io_write_int(sess, fd, idx)) + if (!io_write_int(sess, fd, idx)) ERRX1(sess, "io_write_int"); - else if ( ! io_write_int(sess, fd, blocks->blksz)) + else if (!io_write_int(sess, fd, blocks->blksz)) ERRX1(sess, "io_write_int"); - else if ( ! io_write_int(sess, fd, blocks->len)) + else if (!io_write_int(sess, fd, blocks->len)) ERRX1(sess, "io_write_int"); - else if ( ! io_write_int(sess, fd, blocks->csum)) + else if (!io_write_int(sess, fd, blocks->csum)) ERRX1(sess, "io_write_int"); - else if ( ! io_write_int(sess, fd, blocks->rem)) + else if (!io_write_int(sess, fd, blocks->rem)) ERRX1(sess, "io_write_int"); else return 1; @@ -378,16 +378,16 @@ blk_recv(struct sess *sess, int fd, const char *path) * FIXME: read into buffer and unbuffer. */ - if ( ! io_read_size(sess, fd, &s->blksz)) { + if (!io_read_size(sess, fd, &s->blksz)) { ERRX1(sess, "io_read_size"); goto out; - } else if ( ! io_read_size(sess, fd, &s->len)) { + } else if (!io_read_size(sess, fd, &s->len)) { ERRX1(sess, "io_read_size"); goto out; - } else if ( ! io_read_size(sess, fd, &s->csum)) { + } else if (!io_read_size(sess, fd, &s->csum)) { ERRX1(sess, "io_read_int"); goto out; - } else if ( ! io_read_size(sess, fd, &s->rem)) { + } else if (!io_read_size(sess, fd, &s->rem)) { ERRX1(sess, "io_read_int"); goto out; } else if (s->rem && s->rem >= s->len) { @@ -415,14 +415,14 @@ blk_recv(struct sess *sess, int fd, const char *path) for (j = 0; j < s->blksz; j++) { b = &s->blks[j]; - if ( ! io_read_int(sess, fd, &i)) { + if (!io_read_int(sess, fd, &i)) { ERRX1(sess, "io_read_int"); goto out; } b->chksum_short = i; assert(s->csum <= sizeof(b->chksum_long)); - if ( ! io_read_buf(sess, + if (!io_read_buf(sess, fd, b->chksum_long, s->csum)) { ERRX1(sess, "io_read_buf"); goto out; @@ -470,18 +470,18 @@ blk_send_ack(struct sess *sess, int fd, struct blkset *p) sizeof(int32_t); /* block remainder */ assert(sz <= sizeof(buf)); - if ( ! io_read_buf(sess, fd, buf, sz)) { + if (!io_read_buf(sess, fd, buf, sz)) { ERRX1(sess, "io_read_buf"); return 0; } - if ( ! io_unbuffer_size(sess, buf, &pos, sz, &p->blksz)) + if (!io_unbuffer_size(sess, buf, &pos, sz, &p->blksz)) ERRX1(sess, "io_unbuffer_size"); - else if ( ! io_unbuffer_size(sess, buf, &pos, sz, &p->len)) + else if (!io_unbuffer_size(sess, buf, &pos, sz, &p->len)) ERRX1(sess, "io_unbuffer_size"); - else if ( ! io_unbuffer_size(sess, buf, &pos, sz, &p->csum)) + else if (!io_unbuffer_size(sess, buf, &pos, sz, &p->csum)) ERRX1(sess, "io_unbuffer_size"); - else if ( ! io_unbuffer_size(sess, buf, &pos, sz, &p->rem)) + else if (!io_unbuffer_size(sess, buf, &pos, sz, &p->rem)) ERRX1(sess, "io_unbuffer_size"); else if (p->len && p->rem >= p->len) ERRX1(sess, "non-zero length is less than remainder"); @@ -527,7 +527,7 @@ blk_merge(struct sess *sess, int fd, int ffd, * <0 for a token indicator. */ - if ( ! io_read_int(sess, fd, &rawtok)) { + if (!io_read_int(sess, fd, &rawtok)) { ERRX1(sess, "io_read_int"); goto out; } else if (0 == rawtok) @@ -540,7 +540,7 @@ blk_merge(struct sess *sess, int fd, int ffd, goto out; } buf = pp; - if ( ! io_read_buf(sess, fd, buf, sz)) { + if (!io_read_buf(sess, fd, buf, sz)) { ERRX1(sess, "io_read_int"); goto out; } @@ -605,7 +605,7 @@ blk_merge(struct sess *sess, int fd, int ffd, MD4_Final(ourmd, &ctx); - if ( ! io_read_buf(sess, fd, md, MD4_DIGEST_LENGTH)) { + if (!io_read_buf(sess, fd, md, MD4_DIGEST_LENGTH)) { ERRX1(sess, "io_read_buf"); goto out; } else if (memcmp(md, ourmd, MD4_DIGEST_LENGTH)) { @@ -663,7 +663,7 @@ blk_send(struct sess *sess, int fd, size_t idx, assert(pos == sz); - if ( ! io_write_buf(sess, fd, buf, sz)) { + if (!io_write_buf(sess, fd, buf, sz)) { ERRX1(sess, "io_write_buf"); goto out; } diff --git a/usr.bin/rsync/client.c b/usr.bin/rsync/client.c index 960927e9c8b..02b9bd95a32 100644 --- a/usr.bin/rsync/client.c +++ b/usr.bin/rsync/client.c @@ -1,4 +1,4 @@ -/* $Id: client.c,v 1.2 2019/02/10 23:24:14 benno Exp $ */ +/* $Id: client.c,v 1.3 2019/02/11 19:18:36 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -47,13 +47,13 @@ rsync_client(const struct opts *opts, int fd, const struct fargs *f) sess.opts = opts; sess.lver = RSYNC_PROTOCOL; - if ( ! io_write_int(&sess, fd, sess.lver)) { + if (!io_write_int(&sess, fd, sess.lver)) { ERRX1(&sess, "io_write_int"); goto out; - } else if ( ! io_read_int(&sess, fd, &sess.rver)) { + } else if (!io_read_int(&sess, fd, &sess.rver)) { ERRX1(&sess, "io_read_int"); goto out; - } else if ( ! io_read_int(&sess, fd, &sess.seed)) { + } else if (!io_read_int(&sess, fd, &sess.seed)) { ERRX1(&sess, "io_read_int"); goto out; } @@ -80,7 +80,7 @@ rsync_client(const struct opts *opts, int fd, const struct fargs *f) if (FARGS_RECEIVER != f->mode) { LOG2(&sess, "client starting sender: %s", NULL == f->host ? "(local)" : f->host); - if ( ! rsync_sender(&sess, fd, fd, + if (!rsync_sender(&sess, fd, fd, f->sourcesz, f->sources)) { ERRX1(&sess, "rsync_sender"); goto out; @@ -88,7 +88,7 @@ rsync_client(const struct opts *opts, int fd, const struct fargs *f) } else { LOG2(&sess, "client starting receiver: %s", NULL == f->host ? "(local)" : f->host); - if ( ! rsync_receiver(&sess, fd, fd, f->sink)) { + if (!rsync_receiver(&sess, fd, fd, f->sink)) { ERRX1(&sess, "rsync_receiver"); goto out; } diff --git a/usr.bin/rsync/downloader.c b/usr.bin/rsync/downloader.c index 7046568e0a8..d12171fbe8d 100644 --- a/usr.bin/rsync/downloader.c +++ b/usr.bin/rsync/downloader.c @@ -1,4 +1,4 @@ -/* $Id: downloader.c,v 1.2 2019/02/10 23:24:14 benno Exp $ */ +/* $Id: downloader.c,v 1.3 2019/02/11 19:18:36 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -316,7 +316,7 @@ rsync_downloader(struct download *p, struct sess *sess, int *ofd) */ if (DOWNLOAD_READ_NEXT == p->state) { - if ( ! io_read_int(sess, p->fdin, &idx)) { + if (!io_read_int(sess, p->fdin, &idx)) { ERRX1(sess, "io_read_int"); return -1; } else if (idx >= 0 && (size_t)idx >= p->flsz) { @@ -339,7 +339,7 @@ rsync_downloader(struct download *p, struct sess *sess, int *ofd) */ download_reinit(sess, p, idx); - if ( ! blk_send_ack(sess, p->fdin, &p->blk)) { + if (!blk_send_ack(sess, p->fdin, &p->blk)) { ERRX1(sess, "blk_send_ack"); goto out; } @@ -398,7 +398,7 @@ rsync_downloader(struct download *p, struct sess *sess, int *ofd) -1 == fstat(p->ofd, &st)) { ERR(sess, "%s: fstat", f->path); goto out; - } else if (-1 != p->ofd && ! S_ISREG(st.st_mode)) { + } else if (-1 != p->ofd && !S_ISREG(st.st_mode)) { WARNX(sess, "%s: not regular", f->path); goto out; } @@ -448,7 +448,7 @@ rsync_downloader(struct download *p, struct sess *sess, int *ofd) * or specifically told with -p. */ - if ( ! sess->opts->preserve_perms) + if (!sess->opts->preserve_perms) perm = -1 == p->ofd ? f->st.mode : st.st_mode; else perm = f->st.mode; @@ -488,7 +488,7 @@ rsync_downloader(struct download *p, struct sess *sess, int *ofd) assert(-1 != p->fd); assert(-1 != p->fdin); - if ( ! io_read_int(sess, p->fdin, &rawtok)) { + if (!io_read_int(sess, p->fdin, &rawtok)) { ERRX1(sess, "io_read_int"); goto out; } @@ -499,10 +499,10 @@ rsync_downloader(struct download *p, struct sess *sess, int *ofd) ERR(sess, "realloc"); goto out; } - if ( ! io_read_buf(sess, p->fdin, buf, sz)) { + if (!io_read_buf(sess, p->fdin, buf, sz)) { ERRX1(sess, "io_read_int"); goto out; - } else if ( ! buf_copy(sess, buf, sz, p)) { + } else if (!buf_copy(sess, buf, sz, p)) { ERRX1(sess, "buf_copy"); goto out; } @@ -534,7 +534,7 @@ rsync_downloader(struct download *p, struct sess *sess, int *ofd) */ assert(MAP_FAILED != p->map); - if ( ! buf_copy(sess, buf, sz, p)) { + if (!buf_copy(sess, buf, sz, p)) { ERRX1(sess, "buf_copy"); goto out; } @@ -544,7 +544,7 @@ rsync_downloader(struct download *p, struct sess *sess, int *ofd) return 1; } - if ( ! buf_copy(sess, NULL, 0, p)) { + if (!buf_copy(sess, NULL, 0, p)) { ERRX1(sess, "buf_copy"); goto out; } @@ -562,7 +562,7 @@ rsync_downloader(struct download *p, struct sess *sess, int *ofd) MD4_Final(ourmd, &p->ctx); - if ( ! io_read_buf(sess, p->fdin, md, MD4_DIGEST_LENGTH)) { + if (!io_read_buf(sess, p->fdin, md, MD4_DIGEST_LENGTH)) { ERRX1(sess, "io_read_buf"); goto out; } else if (memcmp(md, ourmd, MD4_DIGEST_LENGTH)) { diff --git a/usr.bin/rsync/flist.c b/usr.bin/rsync/flist.c index dcd62d897c2..584d1e6dea8 100644 --- a/usr.bin/rsync/flist.c +++ b/usr.bin/rsync/flist.c @@ -1,4 +1,4 @@ -/* $Id: flist.c,v 1.3 2019/02/10 23:56:19 benno Exp $ */ +/* $Id: flist.c,v 1.4 2019/02/11 19:18:36 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -147,12 +147,12 @@ flist_topdirs(struct sess *sess, struct flist *fl, size_t flsz) size_t i; const char *cp; - if ( ! sess->opts->recursive) + if (!sess->opts->recursive) return; if (flsz && strcmp(fl[0].wpath, ".")) { for (i = 0; i < flsz; i++) { - if ( ! S_ISDIR(fl[i].st.mode)) + if (!S_ISDIR(fl[i].st.mode)) continue; cp = strchr(fl[i].wpath, '/'); if (NULL != cp && '\0' != cp[1]) @@ -264,7 +264,7 @@ flist_send(struct sess *sess, int fdin, int fdout, const struct flist *fl, if (sess->mplex_reads && io_read_check(sess, fdin) && - ! io_read_flush(sess, fdin)) { + !io_read_flush(sess, fdin)) { ERRX1(sess, "io_read_flush"); return 0; } @@ -286,22 +286,22 @@ flist_send(struct sess *sess, int fdin, int fdout, const struct flist *fl, /* Now write to the wire. */ /* FIXME: buffer this. */ - if ( ! io_write_byte(sess, fdout, flag)) { + if (!io_write_byte(sess, fdout, flag)) { ERRX1(sess, "io_write_byte"); return 0; - } else if ( ! io_write_int(sess, fdout, fnlen)) { + } else if (!io_write_int(sess, fdout, fnlen)) { ERRX1(sess, "io_write_int"); return 0; - } else if ( ! io_write_buf(sess, fdout, fn, fnlen)) { + } else if (!io_write_buf(sess, fdout, fn, fnlen)) { ERRX1(sess, "io_write_buf"); return 0; - } else if ( ! io_write_long(sess, fdout, f->st.size)) { + } else if (!io_write_long(sess, fdout, f->st.size)) { ERRX1(sess, "io_write_long"); return 0; - } else if ( ! io_write_int(sess, fdout, f->st.mtime)) { + } else if (!io_write_int(sess, fdout, f->st.mtime)) { ERRX1(sess, "io_write_int"); return 0; - } else if ( ! io_write_int(sess, fdout, f->st.mode)) { + } else if (!io_write_int(sess, fdout, f->st.mode)) { ERRX1(sess, "io_write_int"); return 0; } @@ -312,11 +312,11 @@ flist_send(struct sess *sess, int fdin, int fdout, const struct flist *fl, sess->opts->preserve_links) { fn = f->link; fnlen = strlen(f->link); - if ( ! io_write_int(sess, fdout, fnlen)) { + if (!io_write_int(sess, fdout, fnlen)) { ERRX1(sess, "io_write_int"); return 0; } - if ( ! io_write_buf(sess, fdout, fn, fnlen)) { + if (!io_write_buf(sess, fdout, fn, fnlen)) { ERRX1(sess, "io_write_int"); return 0; } @@ -326,7 +326,7 @@ flist_send(struct sess *sess, int fdin, int fdout, const struct flist *fl, sess->total_size += f->st.size; } - if ( ! io_write_byte(sess, fdout, 0)) { + if (!io_write_byte(sess, fdout, 0)) { ERRX1(sess, "io_write_byte"); return 0; } @@ -359,7 +359,7 @@ flist_recv_name(struct sess *sess, int fd, struct flist *f, uint8_t flags, */ if (FLIST_NAME_SAME & flags) { - if ( ! io_read_byte(sess, fd, &bval)) { + if (!io_read_byte(sess, fd, &bval)) { ERRX1(sess, "io_read_byte"); return 0; } @@ -369,12 +369,12 @@ flist_recv_name(struct sess *sess, int fd, struct flist *f, uint8_t flags, /* Get the (possibly-remaining) filename length. */ if (FLIST_NAME_LONG & flags) { - if ( ! io_read_size(sess, fd, &pathlen)) { + if (!io_read_size(sess, fd, &pathlen)) { ERRX1(sess, "io_read_size"); return 0; } } else { - if ( ! io_read_byte(sess, fd, &bval)) { + if (!io_read_byte(sess, fd, &bval)) { ERRX1(sess, "io_read_byte"); return 0; } @@ -399,7 +399,7 @@ flist_recv_name(struct sess *sess, int fd, struct flist *f, uint8_t flags, if (FLIST_NAME_SAME & flags) memcpy(f->path, last, partial); - if ( ! io_read_buf(sess, fd, f->path + partial, pathlen)) { + if (!io_read_buf(sess, fd, f->path + partial, pathlen)) { ERRX1(sess, "io_read_buf"); return 0; } @@ -518,13 +518,13 @@ flist_recv(struct sess *sess, int fd, struct flist **flp, size_t *sz) last[0] = '\0'; for (;;) { - if ( ! io_read_byte(sess, fd, &flag)) { + if (!io_read_byte(sess, fd, &flag)) { ERRX1(sess, "io_read_byte"); goto out; } else if (0 == flag) break; - if ( ! flist_realloc(sess, &fl, &flsz, &flmax)) { + if (!flist_realloc(sess, &fl, &flsz, &flmax)) { ERRX1(sess, "flist_realloc"); goto out; } @@ -534,14 +534,14 @@ flist_recv(struct sess *sess, int fd, struct flist **flp, size_t *sz) /* Filename first. */ - if ( ! flist_recv_name(sess, fd, ff, flag, last)) { + if (!flist_recv_name(sess, fd, ff, flag, last)) { ERRX1(sess, "flist_recv_name"); goto out; } /* Read the file size. */ - if ( ! io_read_ulong(sess, fd, &lval)) { + if (!io_read_ulong(sess, fd, &lval)) { ERRX1(sess, "io_read_ulong"); goto out; } @@ -549,8 +549,8 @@ flist_recv(struct sess *sess, int fd, struct flist **flp, size_t *sz) /* Read the modification time. */ - if ( ! (FLIST_TIME_SAME & flag)) { - if ( ! io_read_int(sess, fd, &ival)) { + if (!(FLIST_TIME_SAME & flag)) { + if (!io_read_int(sess, fd, &ival)) { ERRX1(sess, "io_read_int"); goto out; } @@ -563,8 +563,8 @@ flist_recv(struct sess *sess, int fd, struct flist **flp, size_t *sz) /* Read the file mode. */ - if ( ! (FLIST_MODE_SAME & flag)) { - if ( ! io_read_int(sess, fd, &ival)) { + if (!(FLIST_MODE_SAME & flag)) { + if (!io_read_int(sess, fd, &ival)) { ERRX1(sess, "io_read_int"); goto out; } @@ -579,7 +579,7 @@ flist_recv(struct sess *sess, int fd, struct flist **flp, size_t *sz) if (S_ISLNK(ff->st.mode) && sess->opts->preserve_links) { - if ( ! io_read_size(sess, fd, &lsz)) { + if (!io_read_size(sess, fd, &lsz)) { ERRX1(sess, "io_read_size"); goto out; } else if (0 == lsz) { @@ -591,7 +591,7 @@ flist_recv(struct sess *sess, int fd, struct flist **flp, size_t *sz) ERR(sess, "calloc"); goto out; } - if ( ! io_read_buf(sess, fd, ff->link, lsz)) { + if (!io_read_buf(sess, fd, ff->link, lsz)) { ERRX1(sess, "io_read_buf"); goto out; } @@ -651,14 +651,14 @@ flist_gen_dirent(struct sess *sess, char *root, struct flist **fl, size_t *sz, ERR(sess, "%s: lstat", root); return 0; } else if (S_ISREG(st.st_mode)) { - if ( ! flist_realloc(sess, fl, sz, max)) { + if (!flist_realloc(sess, fl, sz, max)) { ERRX1(sess, "flist_realloc"); return 0; } f = &(*fl)[(*sz) - 1]; assert(NULL != f); - if ( ! flist_append(sess, f, &st, root)) { + if (!flist_append(sess, f, &st, root)) { ERRX1(sess, "flist_append"); return 0; } else if (-1 == unveil(root, "r")) { @@ -667,17 +667,17 @@ flist_gen_dirent(struct sess *sess, char *root, struct flist **fl, size_t *sz, } return 1; } else if (S_ISLNK(st.st_mode)) { - if ( ! sess->opts->preserve_links) { + if (!sess->opts->preserve_links) { WARNX(sess, "%s: skipping symlink", root); return 1; - } else if ( ! flist_realloc(sess, fl, sz, max)) { + } else if (!flist_realloc(sess, fl, sz, max)) { ERRX1(sess, "flist_realloc"); return 0; } f = &(*fl)[(*sz) - 1]; assert(NULL != f); - if ( ! flist_append(sess, f, &st, root)) { + if (!flist_append(sess, f, &st, root)) { ERRX1(sess, "flist_append"); return 0; } else if (-1 == unveil(root, "r")) { @@ -685,7 +685,7 @@ flist_gen_dirent(struct sess *sess, char *root, struct flist **fl, size_t *sz, return 0; } return 1; - } else if ( ! S_ISDIR(st.st_mode)) { + } else if (!S_ISDIR(st.st_mode)) { WARNX(sess, "%s: skipping special", root); return 1; } @@ -725,7 +725,7 @@ flist_gen_dirent(struct sess *sess, char *root, struct flist **fl, size_t *sz, errno = 0; while (NULL != (ent = fts_read(fts))) { - if ( ! flist_fts_check(sess, ent)) { + if (!flist_fts_check(sess, ent)) { errno = 0; continue; } @@ -734,7 +734,7 @@ flist_gen_dirent(struct sess *sess, char *root, struct flist **fl, size_t *sz, assert(NULL != ent->fts_statp); if (S_ISLNK(ent->fts_statp->st_mode) && - ! sess->opts->preserve_links) { + !sess->opts->preserve_links) { WARNX(sess, "%s: skipping " "symlink", ent->fts_path); continue; @@ -742,7 +742,7 @@ flist_gen_dirent(struct sess *sess, char *root, struct flist **fl, size_t *sz, /* Allocate a new file entry. */ - if ( ! flist_realloc(sess, fl, sz, max)) { + if (!flist_realloc(sess, fl, sz, max)) { ERRX1(sess, "flist_realloc"); goto out; } @@ -809,7 +809,7 @@ flist_gen_dirs(struct sess *sess, size_t argc, char **argv, struct flist **flp, size_t i, max = 0; for (i = 0; i < argc; i++) - if ( ! flist_gen_dirent(sess, argv[i], flp, sz, &max)) + if (!flist_gen_dirent(sess, argv[i], flp, sz, &max)) break; if (i == argc) { @@ -864,12 +864,12 @@ flist_gen_files(struct sess *sess, size_t argc, char **argv, WARNX(sess, "%s: skipping directory", argv[i]); continue; } else if (S_ISLNK(st.st_mode)) { - if ( ! sess->opts->preserve_links) { + if (!sess->opts->preserve_links) { WARNX(sess, "%s: skipping " "symlink", argv[i]); continue; } - } else if ( ! S_ISREG(st.st_mode)) { + } else if (!S_ISREG(st.st_mode)) { WARNX(sess, "%s: skipping special", argv[i]); continue; } @@ -883,7 +883,7 @@ flist_gen_files(struct sess *sess, size_t argc, char **argv, if (-1 == unveil(argv[i], "r")) { ERR(sess, "%s: unveil", argv[i]); goto out; - } else if ( ! flist_append(sess, f, &st, argv[i])) { + } else if (!flist_append(sess, f, &st, argv[i])) { ERRX1(sess, "flist_append"); goto out; } @@ -924,7 +924,7 @@ flist_gen(struct sess *sess, size_t argc, char **argv, struct flist **flp, if (-1 == unveil(NULL, NULL)) { ERR(sess, "unveil"); return 0; - } else if ( ! rc) + } else if (!rc) return 0; qsort(*flp, *sz, sizeof(struct flist), flist_cmp); @@ -967,7 +967,7 @@ flist_gen_dels(struct sess *sess, const char *root, struct flist **fl, /* Only run this code when we're recursive. */ - if ( ! sess->opts->recursive) + if (!sess->opts->recursive) return 1; /* @@ -1007,7 +1007,7 @@ flist_gen_dels(struct sess *sess, const char *root, struct flist **fl, cargv[1] = NULL; } else { for (i = j = 0; i < wflsz; i++) { - if ( ! (FLSTAT_TOP_DIR & wfl[i].st.flags)) + if (!(FLSTAT_TOP_DIR & wfl[i].st.flags)) continue; assert(S_ISDIR(wfl[i].st.mode)); assert(strcmp(wfl[i].wpath, ".")); @@ -1037,7 +1037,7 @@ flist_gen_dels(struct sess *sess, const char *root, struct flist **fl, * we want to delete. */ - if ( ! hcreate(wflsz)) { + if (!hcreate(wflsz)) { ERR(sess, "hcreate"); goto out; } @@ -1074,7 +1074,7 @@ flist_gen_dels(struct sess *sess, const char *root, struct flist **fl, while (NULL != (ent = fts_read(fts))) { if (FTS_NS == ent->fts_info) continue; - if ( ! flist_fts_check(sess, ent)) { + if (!flist_fts_check(sess, ent)) { errno = 0; continue; } else if (stripdir >= ent->fts_pathlen) @@ -1089,7 +1089,7 @@ flist_gen_dels(struct sess *sess, const char *root, struct flist **fl, /* Not found: we'll delete it. */ - if ( ! flist_realloc(sess, fl, sz, &max)) { + if (!flist_realloc(sess, fl, sz, &max)) { ERRX1(sess, "flist_realloc"); goto out; } diff --git a/usr.bin/rsync/io.c b/usr.bin/rsync/io.c index 55f1b1c142c..c6b59045ce6 100644 --- a/usr.bin/rsync/io.c +++ b/usr.bin/rsync/io.c @@ -1,4 +1,4 @@ -/* $Id: io.c,v 1.2 2019/02/10 23:24:14 benno Exp $ */ +/* $Id: io.c,v 1.3 2019/02/11 19:18:36 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -72,7 +72,7 @@ io_write_nonblocking(struct sess *sess, } else if ((pfd.revents & POLLHUP)) { ERRX(sess, "poll: hangup"); return 0; - } else if ( ! (pfd.revents & POLLOUT)) { + } else if (!(pfd.revents & POLLOUT)) { ERRX(sess, "poll: unknown event"); return 0; } @@ -99,7 +99,7 @@ io_write_blocking(struct sess *sess, while (sz > 0) { c = io_write_nonblocking(sess, fd, buf, sz, &wsz); - if ( ! c) { + if (!c) { ERRX1(sess, "io_write_nonblocking"); return 0; } else if (0 == wsz) { @@ -125,7 +125,7 @@ io_write_buf(struct sess *sess, int fd, const void *buf, size_t sz) size_t wsz; int c; - if ( ! sess->mplex_writes) { + if (!sess->mplex_writes) { c = io_write_blocking(sess, fd, buf, sz); sess->total_write += sz; return c; @@ -135,11 +135,11 @@ io_write_buf(struct sess *sess, int fd, const void *buf, size_t sz) wsz = sz & 0xFFFFFF; tag = (7 << 24) + wsz; tagbuf = htole32(tag); - if ( ! io_write_blocking(sess, fd, &tagbuf, sizeof(tagbuf))) { + if (!io_write_blocking(sess, fd, &tagbuf, sizeof(tagbuf))) { ERRX1(sess, "io_write_blocking"); return 0; } - if ( ! io_write_blocking(sess, fd, buf, wsz)) { + if (!io_write_blocking(sess, fd, buf, wsz)) { ERRX1(sess, "io_write_blocking"); return 0; } @@ -159,9 +159,9 @@ int io_write_line(struct sess *sess, int fd, const char *line) { - if ( ! io_write_buf(sess, fd, line, strlen(line))) + if (!io_write_buf(sess, fd, line, strlen(line))) ERRX1(sess, "io_write_buf"); - else if ( ! io_write_byte(sess, fd, '\n')) + else if (!io_write_byte(sess, fd, '\n')) ERRX1(sess, "io_write_byte"); else return 1; @@ -195,7 +195,7 @@ io_read_nonblocking(struct sess *sess, if ((pfd.revents & (POLLERR|POLLNVAL))) { ERRX(sess, "poll: bad fd"); return 0; - } else if ( ! (pfd.revents & (POLLIN|POLLHUP))) { + } else if (!(pfd.revents & (POLLIN|POLLHUP))) { ERRX(sess, "poll: unknown event"); return 0; } @@ -227,7 +227,7 @@ io_read_blocking(struct sess *sess, while (sz > 0) { c = io_read_nonblocking(sess, fd, buf, sz, &rsz); - if ( ! c) { + if (!c) { ERRX1(sess, "io_read_nonblocking"); return 0; } else if (0 == rsz) { @@ -268,7 +268,7 @@ io_read_flush(struct sess *sess, int fd) * for the remaining data size. */ - if ( ! io_read_blocking(sess, fd, &tagbuf, sizeof(tagbuf))) { + if (!io_read_blocking(sess, fd, &tagbuf, sizeof(tagbuf))) { ERRX1(sess, "io_read_blocking"); return 0; } @@ -286,7 +286,7 @@ io_read_flush(struct sess *sess, int fd) } else if (0 == sess->mplex_read_remain) return 1; - if ( ! io_read_blocking(sess, fd, + if (!io_read_blocking(sess, fd, mpbuf, sess->mplex_read_remain)) { ERRX1(sess, "io_read_blocking"); return 0; @@ -328,7 +328,7 @@ io_read_buf(struct sess *sess, int fd, void *buf, size_t sz) /* If we're not multiplexing, read directly. */ - if ( ! sess->mplex_reads) { + if (!sess->mplex_reads) { assert(0 == sess->mplex_read_remain); c = io_read_blocking(sess, fd, buf, sz); sess->total_read += sz; @@ -346,7 +346,7 @@ io_read_buf(struct sess *sess, int fd, void *buf, size_t sz) if (sess->mplex_read_remain) { rsz = sess->mplex_read_remain < sz ? sess->mplex_read_remain : sz; - if ( ! io_read_blocking(sess, fd, buf, rsz)) { + if (!io_read_blocking(sess, fd, buf, rsz)) { ERRX1(sess, "io_read_blocking"); return 0; } @@ -358,7 +358,7 @@ io_read_buf(struct sess *sess, int fd, void *buf, size_t sz) } assert(0 == sess->mplex_read_remain); - if ( ! io_read_flush(sess, fd)) { + if (!io_read_flush(sess, fd)) { ERRX1(sess, "io_read_flush"); return 0; } @@ -381,9 +381,9 @@ io_write_long(struct sess *sess, int fd, int64_t val) nv = htole64(val); - if ( ! io_write_int(sess, fd, INT32_MAX)) + if (!io_write_int(sess, fd, INT32_MAX)) ERRX(sess, "io_write_int"); - else if ( ! io_write_buf(sess, fd, &nv, sizeof(int64_t))) + else if (!io_write_buf(sess, fd, &nv, sizeof(int64_t))) ERRX(sess, "io_write_buf"); else return 1; @@ -398,7 +398,7 @@ io_write_int(struct sess *sess, int fd, int32_t val) nv = htole32(val); - if ( ! io_write_buf(sess, fd, &nv, sizeof(int32_t))) { + if (!io_write_buf(sess, fd, &nv, sizeof(int32_t))) { ERRX(sess, "io_write_buf"); return 0; } @@ -440,7 +440,7 @@ io_read_ulong(struct sess *sess, int fd, uint64_t *val) { int64_t oval; - if ( ! io_read_long(sess, fd, &oval)) { + if (!io_read_long(sess, fd, &oval)) { ERRX(sess, "io_read_int"); return 0; } else if (oval < 0) { @@ -460,7 +460,7 @@ io_read_long(struct sess *sess, int fd, int64_t *val) /* Start with the short-circuit: read as an int. */ - if ( ! io_read_int(sess, fd, &sval)) { + if (!io_read_int(sess, fd, &sval)) { ERRX(sess, "io_read_int"); return 0; } else if (INT32_MAX != sval) { @@ -470,7 +470,7 @@ io_read_long(struct sess *sess, int fd, int64_t *val) /* If the int is maximal, read as 64 bits. */ - if ( ! io_read_buf(sess, fd, &oval, sizeof(int64_t))) { + if (!io_read_buf(sess, fd, &oval, sizeof(int64_t))) { ERRX(sess, "io_read_buf"); return 0; } @@ -490,7 +490,7 @@ io_read_size(struct sess *sess, int fd, size_t *val) { int32_t oval; - if ( ! io_read_int(sess, fd, &oval)) { + if (!io_read_int(sess, fd, &oval)) { ERRX(sess, "io_read_int"); return 0; } else if (oval < 0) { @@ -507,7 +507,7 @@ io_read_int(struct sess *sess, int fd, int32_t *val) { int32_t oval; - if ( ! io_read_buf(sess, fd, &oval, sizeof(int32_t))) { + if (!io_read_buf(sess, fd, &oval, sizeof(int32_t))) { ERRX(sess, "io_read_buf"); return 0; } @@ -565,7 +565,7 @@ int io_read_byte(struct sess *sess, int fd, uint8_t *val) { - if ( ! io_read_buf(sess, fd, val, sizeof(uint8_t))) { + if (!io_read_buf(sess, fd, val, sizeof(uint8_t))) { ERRX(sess, "io_read_buf"); return 0; } @@ -576,7 +576,7 @@ int io_write_byte(struct sess *sess, int fd, uint8_t val) { - if ( ! io_write_buf(sess, fd, &val, sizeof(uint8_t))) { + if (!io_write_buf(sess, fd, &val, sizeof(uint8_t))) { ERRX(sess, "io_write_buf"); return 0; } diff --git a/usr.bin/rsync/main.c b/usr.bin/rsync/main.c index 44129c2dc85..91adbb86493 100644 --- a/usr.bin/rsync/main.c +++ b/usr.bin/rsync/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.3 2019/02/10 23:43:31 benno Exp $ */ +/* $Id: main.c,v 1.4 2019/02/11 19:18:36 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -171,10 +171,10 @@ fargs_parse(size_t argc, char *argv[]) /* Make sure we have the same "hostspec" for all files. */ - if ( ! f->remote) { + if (!f->remote) { if (FARGS_SENDER == f->mode) for (i = 0; i < f->sourcesz; i++) { - if ( ! fargs_is_remote(f->sources[i])) + if (!fargs_is_remote(f->sources[i])) continue; errx(EXIT_FAILURE, "remote file in " "list of local sources: %s", @@ -183,7 +183,7 @@ fargs_parse(size_t argc, char *argv[]) if (FARGS_RECEIVER == f->mode) for (i = 0; i < f->sourcesz; i++) { if (fargs_is_remote(f->sources[i]) && - ! fargs_is_daemon(f->sources[i])) + !fargs_is_daemon(f->sources[i])) continue; if (fargs_is_daemon(f->sources[i])) errx(EXIT_FAILURE, "remote " @@ -212,7 +212,7 @@ fargs_parse(size_t argc, char *argv[]) * Then exit if we're a sender or a local connection. */ - if ( ! f->remote) { + if (!f->remote) { if (NULL == f->host) return f; if (FARGS_SENDER == f->mode) { @@ -435,14 +435,14 @@ main(int argc, char *argv[]) * So close the connection here so that they don't hang. */ - if ( ! c) { + if (!c) { close(fds[0]); fds[0] = -1; } if (-1 == waitpid(child, &st, 0)) err(EXIT_FAILURE, "waitpid"); - if ( ! (WIFEXITED(st) && EXIT_SUCCESS == WEXITSTATUS(st))) + if (!(WIFEXITED(st) && EXIT_SUCCESS == WEXITSTATUS(st))) c = 0; if (-1 != fds[0]) diff --git a/usr.bin/rsync/receiver.c b/usr.bin/rsync/receiver.c index 2ce39b2a7b5..f7f416d84ae 100644 --- a/usr.bin/rsync/receiver.c +++ b/usr.bin/rsync/receiver.c @@ -1,4 +1,4 @@ -/* $Id: receiver.c,v 1.3 2019/02/10 23:43:31 benno Exp $ */ +/* $Id: receiver.c,v 1.4 2019/02/11 19:18:36 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> @@ -65,14 +65,14 @@ rsync_receiver(struct sess *sess, /* Client sends zero-length exclusions. */ - if ( ! sess->opts->server && - ! io_write_int(sess, fdout, 0)) { + if (!sess->opts->server && + !io_write_int(sess, fdout, 0)) { ERRX1(sess, "io_write_int"); goto out; } if (sess->opts->server && sess->opts->del) { - if ( ! io_read_size(sess, fdin, &excl)) { + if (!io_read_size(sess, fdin, &excl)) { ERRX1(sess, "io_read_size"); goto out; } else if (0 != excl) { @@ -86,14 +86,14 @@ rsync_receiver(struct sess *sess, * These we're going to be touching on our local system. */ - if ( ! flist_recv(sess, fdin, &fl, &flsz)) { + if (!flist_recv(sess, fdin, &fl, &flsz)) { ERRX1(sess, "flist_recv"); goto out; } /* The IO error is sent after the file list. */ - if ( ! io_read_int(sess, fdin, &ioerror)) { + if (!io_read_int(sess, fdin, &ioerror)) { ERRX1(sess, "io_read_int"); goto out; } else if (0 != ioerror) { @@ -101,11 +101,11 @@ rsync_receiver(struct sess *sess, goto out; } - if (0 == flsz && ! sess->opts->server) { + if (0 == flsz && !sess->opts->server) { WARNX(sess, "receiver has empty file list: exiting"); rc = 1; goto out; - } else if ( ! sess->opts->server) + } else if (!sess->opts->server) LOG1(sess, "Transfer starting: %zu files", flsz); LOG2(sess, "%s: receiver destination", root); @@ -117,7 +117,7 @@ rsync_receiver(struct sess *sess, * this directory in post_dir(). */ - if ( ! sess->opts->dry_run) { + if (!sess->opts->dry_run) { if (NULL == (tofree = strdup(root))) { ERR(sess, "strdup"); goto out; @@ -136,7 +136,7 @@ rsync_receiver(struct sess *sess, oumask = umask(0); - if ( ! sess->opts->dry_run) { + if (!sess->opts->dry_run) { dfd = open(root, O_RDONLY | O_DIRECTORY, 0); if (-1 == dfd) { ERR(sess, "%s: open", root); @@ -154,7 +154,7 @@ rsync_receiver(struct sess *sess, if (sess->opts->del && sess->opts->recursive && - ! flist_gen_dels(sess, root, &dfl, &dflsz, fl, flsz)) { + !flist_gen_dels(sess, root, &dfl, &dflsz, fl, flsz)) { ERRX1(sess, "flist_gen_local"); goto out; } @@ -176,7 +176,7 @@ rsync_receiver(struct sess *sess, /* If we have a local set, go for the deletion. */ - if ( ! flist_del(sess, dfd, dfl, dflsz)) { + if (!flist_del(sess, dfd, dfl, dflsz)) { ERRX1(sess, "flist_del"); goto out; } @@ -234,7 +234,7 @@ rsync_receiver(struct sess *sess, if (sess->mplex_reads && (POLLIN & pfd[PFD_SENDER_IN].revents)) { - if ( ! io_read_flush(sess, fdin)) { + if (!io_read_flush(sess, fdin)) { ERRX1(sess, "io_read_flush"); goto out; } else if (0 == sess->mplex_read_remain) @@ -296,10 +296,10 @@ rsync_receiver(struct sess *sess, /* Properly close us out by progressing through the phases. */ if (1 == phase) { - if ( ! io_write_int(sess, fdout, -1)) { + if (!io_write_int(sess, fdout, -1)) { ERRX1(sess, "io_write_int"); goto out; - } else if ( ! io_read_int(sess, fdin, &ioerror)) { + } else if (!io_read_int(sess, fdin, &ioerror)) { ERRX1(sess, "io_read_int"); goto out; } else if (-1 != ioerror) { @@ -313,17 +313,17 @@ rsync_receiver(struct sess *sess, * directory permissions. */ - if ( ! rsync_uploader_tail(ul, sess)) { + if (!rsync_uploader_tail(ul, sess)) { ERRX1(sess, "rsync_uploader_tail"); goto out; } /* Process server statistics and say good-bye. */ - if ( ! sess_stats_recv(sess, fdin)) { + if (!sess_stats_recv(sess, fdin)) { ERRX1(sess, "sess_stats_recv"); goto out; - } else if ( ! io_write_int(sess, fdout, -1)) { + } else if (!io_write_int(sess, fdout, -1)) { ERRX1(sess, "io_write_int"); goto out; } diff --git a/usr.bin/rsync/sender.c b/usr.bin/rsync/sender.c index ddb82373d17..e20e3ca590c 100644 --- a/usr.bin/rsync/sender.c +++ b/usr.bin/rsync/sender.c @@ -1,4 +1,4 @@ -/* $Id: sender.c,v 1.3 2019/02/10 23:43:31 benno Exp $ */ +/* $Id: sender.c,v 1.4 2019/02/11 19:18:36 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -54,15 +54,15 @@ rsync_sender(struct sess *sess, int fdin, * This will also remove all invalid files. */ - if ( ! flist_gen(sess, argc, argv, &fl, &flsz)) { + if (!flist_gen(sess, argc, argv, &fl, &flsz)) { ERRX1(sess, "flist_gen"); goto out; } /* Client sends zero-length exclusions if deleting. */ - if ( ! sess->opts->server && sess->opts->del && - ! io_write_int(sess, fdout, 0)) { + if (!sess->opts->server && sess->opts->del && + !io_write_int(sess, fdout, 0)) { ERRX1(sess, "io_write_int"); goto out; } @@ -72,10 +72,10 @@ rsync_sender(struct sess *sess, int fdin, * Finally, the IO error (always zero for us). */ - if ( ! flist_send(sess, fdin, fdout, fl, flsz)) { + if (!flist_send(sess, fdin, fdout, fl, flsz)) { ERRX1(sess, "flist_send"); goto out; - } else if ( ! io_write_int(sess, fdout, 0)) { + } else if (!io_write_int(sess, fdout, 0)) { ERRX1(sess, "io_write_int"); goto out; } @@ -86,7 +86,7 @@ rsync_sender(struct sess *sess, int fdin, WARNX(sess, "sender has empty file list: exiting"); rc = 1; goto out; - } else if ( ! sess->opts->server) + } else if (!sess->opts->server) LOG1(sess, "Transfer starting: %zu files", flsz); /* @@ -95,7 +95,7 @@ rsync_sender(struct sess *sess, int fdin, */ if (sess->opts->server) { - if ( ! io_read_size(sess, fdin, &excl)) { + if (!io_read_size(sess, fdin, &excl)) { ERRX1(sess, "io_read_size"); goto out; } else if (0 != excl) { @@ -112,7 +112,7 @@ rsync_sender(struct sess *sess, int fdin, LOG2(sess, "sender transmitting phase 1 data"); for (;;) { - if ( ! io_read_int(sess, fdin, &idx)) { + if (!io_read_int(sess, fdin, &idx)) { ERRX1(sess, "io_read_int"); goto out; } @@ -124,7 +124,7 @@ rsync_sender(struct sess *sess, int fdin, */ if (-1 == idx) { - if ( ! io_write_int(sess, fdout, idx)) { + if (!io_write_int(sess, fdout, idx)) { ERRX1(sess, "io_write_int"); goto out; } @@ -132,7 +132,7 @@ rsync_sender(struct sess *sess, int fdin, /* FIXME: I don't understand this ack. */ if (sess->opts->server && sess->rver > 27) - if ( ! io_write_int(sess, fdout, idx)) { + if (!io_write_int(sess, fdout, idx)) { ERRX1(sess, "io_write_int"); goto out; } @@ -158,19 +158,19 @@ rsync_sender(struct sess *sess, int fdin, ERRX(sess, "blocks requested for " "symlink: %s", fl[idx].path); goto out; - } else if ( ! S_ISREG(fl[idx].st.mode)) { + } else if (!S_ISREG(fl[idx].st.mode)) { ERRX(sess, "blocks requested for " "special: %s", fl[idx].path); goto out; } - if ( ! sess->opts->server) + if (!sess->opts->server) LOG1(sess, "%s", fl[idx].wpath); /* Dry-run doesn't do anything. */ if (sess->opts->dry_run) { - if ( ! io_write_int(sess, fdout, idx)) { + if (!io_write_int(sess, fdout, idx)) { ERRX1(sess, "io_write_int"); goto out; } @@ -190,7 +190,7 @@ rsync_sender(struct sess *sess, int fdin, if (NULL == blks) { ERRX1(sess, "blk_recv"); goto out; - } else if ( ! blk_recv_ack(sess, fdout, blks, idx)) { + } else if (!blk_recv_ack(sess, fdout, blks, idx)) { ERRX1(sess, "blk_recv_ack"); goto out; } @@ -198,20 +198,20 @@ rsync_sender(struct sess *sess, int fdin, c = blk_match(sess, fdout, blks, fl[idx].path); blkset_free(blks); - if ( ! c) { + if (!c) { ERRX1(sess, "blk_match"); goto out; } } - if ( ! sess_stats_send(sess, fdout)) { + if (!sess_stats_send(sess, fdout)) { ERRX1(sess, "sess_stats_end"); goto out; } /* Final "goodbye" message. */ - if ( ! io_read_int(sess, fdin, &idx)) { + if (!io_read_int(sess, fdin, &idx)) { ERRX1(sess, "io_read_int"); goto out; } else if (-1 != idx) { diff --git a/usr.bin/rsync/server.c b/usr.bin/rsync/server.c index 9a01d33e99e..ae0405c709b 100644 --- a/usr.bin/rsync/server.c +++ b/usr.bin/rsync/server.c @@ -1,4 +1,4 @@ -/* $Id: server.c,v 1.2 2019/02/10 23:24:14 benno Exp $ */ +/* $Id: server.c,v 1.3 2019/02/11 19:18:36 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -62,8 +62,8 @@ rsync_server(const struct opts *opts, size_t argc, char *argv[]) /* Begin by making descriptors non-blocking. */ - if ( ! fcntl_nonblock(&sess, fdin) || - ! fcntl_nonblock(&sess, fdout)) { + if (!fcntl_nonblock(&sess, fdin) || + !fcntl_nonblock(&sess, fdout)) { ERRX1(&sess, "fcntl_nonblock"); goto out; } @@ -73,13 +73,13 @@ rsync_server(const struct opts *opts, size_t argc, char *argv[]) sess.lver = RSYNC_PROTOCOL; sess.seed = arc4random(); - if ( ! io_read_int(&sess, fdin, &sess.rver)) { + if (!io_read_int(&sess, fdin, &sess.rver)) { ERRX1(&sess, "io_read_int"); goto out; - } else if ( ! io_write_int(&sess, fdout, sess.lver)) { + } else if (!io_write_int(&sess, fdout, sess.lver)) { ERRX1(&sess, "io_write_int"); goto out; - } else if ( ! io_write_int(&sess, fdout, sess.seed)) { + } else if (!io_write_int(&sess, fdout, sess.seed)) { ERRX1(&sess, "io_write_int"); goto out; } @@ -121,7 +121,7 @@ rsync_server(const struct opts *opts, size_t argc, char *argv[]) goto out; } - if ( ! rsync_sender(&sess, fdin, fdout, argc, argv)) { + if (!rsync_sender(&sess, fdin, fdout, argc, argv)) { ERRX1(&sess, "rsync_sender"); goto out; } @@ -144,7 +144,7 @@ rsync_server(const struct opts *opts, size_t argc, char *argv[]) goto out; } - if ( ! rsync_receiver(&sess, fdin, fdout, argv[1])) { + if (!rsync_receiver(&sess, fdin, fdout, argv[1])) { ERRX1(&sess, "rsync_receiver"); goto out; } diff --git a/usr.bin/rsync/session.c b/usr.bin/rsync/session.c index b8ac6e956f9..94a5a79d31b 100644 --- a/usr.bin/rsync/session.c +++ b/usr.bin/rsync/session.c @@ -1,4 +1,4 @@ -/* $Id: session.c,v 1.2 2019/02/10 23:24:14 benno Exp $ */ +/* $Id: session.c,v 1.3 2019/02/11 19:18:36 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -113,13 +113,13 @@ sess_stats_send(struct sess *sess, int fd) ts = sess->total_size; if (sess->opts->server) { - if ( ! io_write_long(sess, fd, tr)) { + if (!io_write_long(sess, fd, tr)) { ERRX1(sess, "io_write_long"); return 0; - } else if ( ! io_write_long(sess, fd, tw)) { + } else if (!io_write_long(sess, fd, tw)) { ERRX1(sess, "io_write_long"); return 0; - } else if ( ! io_write_long(sess, fd, ts)) { + } else if (!io_write_long(sess, fd, ts)) { ERRX1(sess, "io_write_long"); return 0; } @@ -144,13 +144,13 @@ sess_stats_recv(struct sess *sess, int fd) if (sess->opts->server || 0 == sess->opts->verbose) return 1; - if ( ! io_read_ulong(sess, fd, &tw)) { + if (!io_read_ulong(sess, fd, &tw)) { ERRX1(sess, "io_read_ulong"); return 0; - } else if ( ! io_read_ulong(sess, fd, &tr)) { + } else if (!io_read_ulong(sess, fd, &tr)) { ERRX1(sess, "io_read_ulong"); return 0; - } else if ( ! io_read_ulong(sess, fd, &ts)) { + } else if (!io_read_ulong(sess, fd, &ts)) { ERRX1(sess, "io_read_ulong"); return 0; } diff --git a/usr.bin/rsync/socket.c b/usr.bin/rsync/socket.c index fd323d74f54..88727b0d922 100644 --- a/usr.bin/rsync/socket.c +++ b/usr.bin/rsync/socket.c @@ -1,4 +1,4 @@ -/* $Id: socket.c,v 1.3 2019/02/10 23:43:31 benno Exp $ */ +/* $Id: socket.c,v 1.4 2019/02/11 19:18:36 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -305,14 +305,14 @@ rsync_socket(const struct opts *opts, const struct fargs *f) LOG2(&sess, "connected: %s, %s", src[i].ip, f->host); (void)snprintf(buf, sizeof(buf), "@RSYNCD: %d", sess.lver); - if ( ! io_write_line(&sess, sd, buf)) { + if (!io_write_line(&sess, sd, buf)) { ERRX1(&sess, "io_write_line"); goto out; } LOG2(&sess, "requesting module: %s, %s", f->module, f->host); - if ( ! io_write_line(&sess, sd, f->module)) { + if (!io_write_line(&sess, sd, f->module)) { ERRX1(&sess, "io_write_line"); goto out; } @@ -327,7 +327,7 @@ rsync_socket(const struct opts *opts, const struct fargs *f) for (;;) { for (i = 0; i < sizeof(buf); i++) { - if ( ! io_read_byte(&sess, sd, &byte)) { + if (!io_read_byte(&sess, sd, &byte)) { ERRX1(&sess, "io_read_byte"); goto out; } @@ -373,11 +373,11 @@ rsync_socket(const struct opts *opts, const struct fargs *f) i = 1; /* rsync... */ for ( ; NULL != args[i]; i++) - if ( ! io_write_line(&sess, sd, args[i])) { + if (!io_write_line(&sess, sd, args[i])) { ERRX1(&sess, "io_write_line"); goto out; } - if ( ! io_write_byte(&sess, sd, '\n')) { + if (!io_write_byte(&sess, sd, '\n')) { ERRX1(&sess, "io_write_line"); goto out; } @@ -389,7 +389,7 @@ rsync_socket(const struct opts *opts, const struct fargs *f) /* Protocol exchange: get the random seed. */ - if ( ! io_read_int(&sess, sd, &sess.seed)) { + if (!io_read_int(&sess, sd, &sess.seed)) { ERRX1(&sess, "io_read_int"); goto out; } @@ -414,7 +414,7 @@ rsync_socket(const struct opts *opts, const struct fargs *f) assert(FARGS_RECEIVER == f->mode); LOG2(&sess, "client starting receiver: %s", f->host); - if ( ! rsync_receiver(&sess, sd, sd, f->sink)) { + if (!rsync_receiver(&sess, sd, sd, f->sink)) { ERRX1(&sess, "rsync_receiver"); goto out; } diff --git a/usr.bin/rsync/uploader.c b/usr.bin/rsync/uploader.c index cee66f5d320..9d537992db6 100644 --- a/usr.bin/rsync/uploader.c +++ b/usr.bin/rsync/uploader.c @@ -1,4 +1,4 @@ -/* $Id: uploader.c,v 1.2 2019/02/10 23:24:14 benno Exp $ */ +/* $Id: uploader.c,v 1.3 2019/02/11 19:18:36 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -83,7 +83,7 @@ static void log_link(struct sess *sess, const struct flist *f) { - if ( ! sess->opts->server) + if (!sess->opts->server) LOG1(sess, "%s -> %s", f->path, f->link); } @@ -94,7 +94,7 @@ static void log_file(struct sess *sess, const struct flist *f) { - if ( ! sess->opts->server) + if (!sess->opts->server) LOG1(sess, "%s", f->path); } @@ -177,7 +177,7 @@ pre_link(struct upload *p, struct sess *sess) f = &p->fl[p->idx]; assert(S_ISLNK(f->st.mode)); - if ( ! sess->opts->preserve_links) { + if (!sess->opts->preserve_links) { WARNX(sess, "%s: ignoring symlink", f->path); return 0; } else if (sess->opts->dry_run) { @@ -189,7 +189,7 @@ pre_link(struct upload *p, struct sess *sess) assert(-1 != p->rootfd); rc = fstatat(p->rootfd, f->path, &st, AT_SYMLINK_NOFOLLOW); - if (-1 != rc && ! S_ISLNK(st.st_mode)) { + if (-1 != rc && !S_ISLNK(st.st_mode)) { WARNX(sess, "%s: not a symlink", f->path); return -1; } else if (-1 == rc && ENOENT != errno) { @@ -287,7 +287,7 @@ pre_dir(const struct upload *p, struct sess *sess) f = &p->fl[p->idx]; assert(S_ISDIR(f->st.mode)); - if ( ! sess->opts->recursive) { + if (!sess->opts->recursive) { WARNX(sess, "%s: ignoring directory", f->path); return 0; } else if (sess->opts->dry_run) { @@ -300,7 +300,7 @@ pre_dir(const struct upload *p, struct sess *sess) if (-1 == rc && ENOENT != errno) { WARN(sess, "%s: fstatat", f->path); return -1; - } else if (-1 != rc && ! S_ISDIR(st.st_mode)) { + } else if (-1 != rc && !S_ISDIR(st.st_mode)) { WARNX(sess, "%s: not a directory", f->path); return -1; } else if (-1 != rc) { @@ -348,7 +348,7 @@ post_dir(struct sess *sess, const struct upload *u, size_t idx) /* We already warned about the directory in pre_process_dir(). */ - if ( ! sess->opts->recursive) + if (!sess->opts->recursive) return 1; else if (sess->opts->dry_run) return 1; @@ -356,7 +356,7 @@ post_dir(struct sess *sess, const struct upload *u, size_t idx) if (-1 == fstatat(u->rootfd, f->path, &st, AT_SYMLINK_NOFOLLOW)) { ERR(sess, "%s: fstatat", f->path); return 0; - } else if ( ! S_ISDIR(st.st_mode)) { + } else if (!S_ISDIR(st.st_mode)) { WARNX(sess, "%s: not a directory", f->path); return 0; } @@ -416,7 +416,7 @@ pre_file(const struct upload *p, int *filefd, struct sess *sess) if (sess->opts->dry_run) { log_file(sess, f); - if ( ! io_write_int(sess, p->fdout, p->idx)) { + if (!io_write_int(sess, p->fdout, p->idx)) { ERRX1(sess, "io_write_int"); return -1; } @@ -591,7 +591,7 @@ rsync_uploader(struct upload *u, int *fileinfd, *fileoutfd = -1; if (u->idx == u->flsz) { assert(-1 == *fileinfd); - if ( ! io_write_int(sess, u->fdout, -1)) { + if (!io_write_int(sess, u->fdout, -1)) { ERRX1(sess, "io_write_int"); return -1; } @@ -623,7 +623,7 @@ rsync_uploader(struct upload *u, int *fileinfd, close(*fileinfd); *fileinfd = -1; return -1; - } else if ( ! S_ISREG(st.st_mode)) { + } else if (!S_ISREG(st.st_mode)) { WARNX(sess, "%s: not regular", u->fl[u->idx].path); close(*fileinfd); *fileinfd = -1; @@ -757,15 +757,15 @@ rsync_uploader_tail(struct upload *u, struct sess *sess) size_t i; - if ( ! sess->opts->preserve_times && - ! sess->opts->preserve_perms) + if (!sess->opts->preserve_times && + !sess->opts->preserve_perms) return 1; LOG2(sess, "fixing up directory times and permissions"); for (i = 0; i < u->flsz; i++) if (S_ISDIR(u->fl[i].st.mode)) - if ( ! post_dir(sess, u, i)) + if (!post_dir(sess, u, i)) return 0; return 1; |