From 51af77722a3ec9561cb52a8be503a9d7e911fe39 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 16 Feb 2019 05:06:31 +0000 Subject: unwrap lines which do not need wrapping --- usr.bin/rsync/client.c | 6 +++--- usr.bin/rsync/flist.c | 5 ++--- usr.bin/rsync/io.c | 12 +++++------- usr.bin/rsync/receiver.c | 5 ++--- usr.bin/rsync/sender.c | 4 ++-- usr.bin/rsync/socket.c | 22 ++++++++++------------ usr.bin/rsync/uploader.c | 14 +++++--------- 7 files changed, 29 insertions(+), 39 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/rsync/client.c b/usr.bin/rsync/client.c index 7a869f24cfb..b1ee457dc27 100644 --- a/usr.bin/rsync/client.c +++ b/usr.bin/rsync/client.c @@ -1,4 +1,4 @@ -/* $Id: client.c,v 1.4 2019/02/11 21:41:22 deraadt Exp $ */ +/* $Id: client.c,v 1.5 2019/02/16 05:06:30 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -80,8 +80,8 @@ rsync_client(const struct opts *opts, int fd, const struct fargs *f) if (FARGS_RECEIVER != f->mode) { LOG2(&sess, "client starting sender: %s", f->host == NULL ? "(local)" : f->host); - if (!rsync_sender(&sess, fd, fd, - f->sourcesz, f->sources)) { + if (!rsync_sender(&sess, fd, fd, f->sourcesz, + f->sources)) { ERRX1(&sess, "rsync_sender"); goto out; } diff --git a/usr.bin/rsync/flist.c b/usr.bin/rsync/flist.c index bc7be5450bc..bf90db31947 100644 --- a/usr.bin/rsync/flist.c +++ b/usr.bin/rsync/flist.c @@ -1,4 +1,4 @@ -/* $Id: flist.c,v 1.13 2019/02/14 18:26:52 florian Exp $ */ +/* $Id: flist.c,v 1.14 2019/02/16 05:06:30 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -1146,8 +1146,7 @@ flist_gen_dels(struct sess *sess, const char *root, struct flist **fl, cargv[j] = NULL; goto out; } - LOG4(sess, "%s: will scan " - "for deletions", cargv[j]); + LOG4(sess, "%s: will scan for deletions", cargv[j]); j++; } assert(j == cargvs); diff --git a/usr.bin/rsync/io.c b/usr.bin/rsync/io.c index ab598daa185..02bc09f7777 100644 --- a/usr.bin/rsync/io.c +++ b/usr.bin/rsync/io.c @@ -1,4 +1,4 @@ -/* $Id: io.c,v 1.4 2019/02/11 21:41:22 deraadt Exp $ */ +/* $Id: io.c,v 1.5 2019/02/16 05:06:30 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -48,8 +48,8 @@ io_read_check(struct sess *sess, int fd) * Returns zero on failure, non-zero on success (zero or more bytes). */ static int -io_write_nonblocking(struct sess *sess, - int fd, const void *buf, size_t bsz, size_t *sz) +io_write_nonblocking(struct sess *sess, int fd, const void *buf, size_t bsz, + size_t *sz) { struct pollfd pfd; ssize_t wsz; @@ -91,8 +91,7 @@ io_write_nonblocking(struct sess *sess, * Returns 0 on failure, non-zero on success (all bytes written). */ static int -io_write_blocking(struct sess *sess, - int fd, const void *buf, size_t sz) +io_write_blocking(struct sess *sess, int fd, const void *buf, size_t sz) { size_t wsz; int c; @@ -540,8 +539,7 @@ io_unbuffer_int(struct sess *sess, const void *buf, { int32_t oval; - io_unbuffer_buf(sess, buf, bufpos, - bufsz, &oval, sizeof(int32_t)); + io_unbuffer_buf(sess, buf, bufpos, bufsz, &oval, sizeof(int32_t)); *val = le32toh(oval); } diff --git a/usr.bin/rsync/receiver.c b/usr.bin/rsync/receiver.c index fc66bbd0f35..e6d869e8d41 100644 --- a/usr.bin/rsync/receiver.c +++ b/usr.bin/rsync/receiver.c @@ -1,4 +1,4 @@ -/* $Id: receiver.c,v 1.8 2019/02/14 18:30:11 florian Exp $ */ +/* $Id: receiver.c,v 1.9 2019/02/16 05:06:30 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons @@ -94,8 +94,7 @@ rsync_set_metadata(struct sess *sess, int newfile, * Pledges (dry-run): -cpath, -wpath, -fattr. */ int -rsync_receiver(struct sess *sess, - int fdin, int fdout, const char *root) +rsync_receiver(struct sess *sess, int fdin, int fdout, const char *root) { struct flist *fl = NULL, *dfl = NULL; size_t i, flsz = 0, dflsz = 0, excl; diff --git a/usr.bin/rsync/sender.c b/usr.bin/rsync/sender.c index a881d4cd085..ea732ecb905 100644 --- a/usr.bin/rsync/sender.c +++ b/usr.bin/rsync/sender.c @@ -1,4 +1,4 @@ -/* $Id: sender.c,v 1.6 2019/02/12 17:58:35 benno Exp $ */ +/* $Id: sender.c,v 1.7 2019/02/16 05:06:30 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -62,7 +62,7 @@ rsync_sender(struct sess *sess, int fdin, /* Client sends zero-length exclusions if deleting. */ if (!sess->opts->server && sess->opts->del && - !io_write_int(sess, fdout, 0)) { + !io_write_int(sess, fdout, 0)) { ERRX1(sess, "io_write_int"); goto out; } diff --git a/usr.bin/rsync/socket.c b/usr.bin/rsync/socket.c index dbd1cd65167..3848eaa1d1d 100644 --- a/usr.bin/rsync/socket.c +++ b/usr.bin/rsync/socket.c @@ -1,4 +1,4 @@ -/* $Id: socket.c,v 1.6 2019/02/12 19:20:15 benno Exp $ */ +/* $Id: socket.c,v 1.7 2019/02/16 05:06:30 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -71,13 +71,11 @@ inet_connect(struct sess *sess, int *sd, * while waiting for this to finish. */ - c = connect(*sd, - (const struct sockaddr *)&src->sa, - src->salen); + c = connect(*sd, (const struct sockaddr *)&src->sa, src->salen); if (c == -1) { if (errno == ECONNREFUSED || errno == EHOSTUNREACH) { - WARNX(sess, "connect refused: " - "%s, %s", src->ip, host); + WARNX(sess, "connect refused: %s, %s", + src->ip, host); return 0; } ERR(sess, "connect"); @@ -124,11 +122,11 @@ inet_resolve(struct sess *sess, const char *host, size_t *sz) if (error == EAI_AGAIN || error == EAI_NONAME) { ERRX(sess, "DNS resolve error: %s: %s", - host, gai_strerror(error)); + host, gai_strerror(error)); return NULL; } else if (error) { ERRX(sess, "DNS parse error: %s: %s", - host, gai_strerror(error)); + host, gai_strerror(error)); return NULL; } @@ -170,13 +168,13 @@ inet_resolve(struct sess *sess, const char *host, size_t *sz) if (res->ai_family == AF_INET) { src[i].family = PF_INET; inet_ntop(AF_INET, - &(((struct sockaddr_in *)sa)->sin_addr), - src[i].ip, INET6_ADDRSTRLEN); + &(((struct sockaddr_in *)sa)->sin_addr), + src[i].ip, INET6_ADDRSTRLEN); } else { src[i].family = PF_INET6; inet_ntop(AF_INET6, - &(((struct sockaddr_in6 *)sa)->sin6_addr), - src[i].ip, INET6_ADDRSTRLEN); + &(((struct sockaddr_in6 *)sa)->sin6_addr), + src[i].ip, INET6_ADDRSTRLEN); } LOG2(sess, "DNS resolved: %s: %s", host, src[i].ip); diff --git a/usr.bin/rsync/uploader.c b/usr.bin/rsync/uploader.c index 7bd04d1a629..81c6fd88f64 100644 --- a/usr.bin/rsync/uploader.c +++ b/usr.bin/rsync/uploader.c @@ -1,4 +1,4 @@ -/* $Id: uploader.c,v 1.6 2019/02/14 18:31:01 florian Exp $ */ +/* $Id: uploader.c,v 1.7 2019/02/16 05:06:30 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -71,8 +71,7 @@ log_dir(struct sess *sess, const struct flist *f) return; sz = strlen(f->path); assert(sz > 0); - LOG1(sess, "%s%s", f->path, - '/' == f->path[sz - 1] ? "" : "/"); + LOG1(sess, "%s%s", f->path, ('/' == f->path[sz - 1]) ? "" : "/"); } /* @@ -247,8 +246,7 @@ pre_link(struct upload *p, struct sess *sess) tv[0].tv_nsec = 0; tv[1].tv_sec = f->st.mtime; tv[1].tv_nsec = 0; - rc = utimensat(p->rootfd, - f->path, tv, AT_SYMLINK_NOFOLLOW); + rc = utimensat(p->rootfd, f->path, tv, AT_SYMLINK_NOFOLLOW); if (rc == -1) { ERR(sess, "%s: utimensat", f->path); return -1; @@ -262,8 +260,7 @@ pre_link(struct upload *p, struct sess *sess) */ if (newlink || sess->opts->preserve_perms) { - rc = fchmodat(p->rootfd, - f->path, f->st.mode, AT_SYMLINK_NOFOLLOW); + rc = fchmodat(p->rootfd, f->path, f->st.mode, AT_SYMLINK_NOFOLLOW); if (rc == -1) { ERR(sess, "%s: fchmodat", f->path); return -1; @@ -670,8 +667,7 @@ rsync_uploader(struct upload *u, int *fileinfd, if (*fileinfd != -1 && st.st_size > 0) { mapsz = st.st_size; - map = mmap(NULL, mapsz, - PROT_READ, MAP_SHARED, *fileinfd, 0); + map = mmap(NULL, mapsz, PROT_READ, MAP_SHARED, *fileinfd, 0); if (map == MAP_FAILED) { WARN(sess, "%s: mmap", u->fl[u->idx].path); close(*fileinfd); -- cgit v1.2.3