git: b210c33a91ee - main - mv: Type and style nits.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 13 Nov 2024 13:49:49 UTC
The branch main has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=b210c33a91ee9de41495a03a8bbff81f25be73b9
commit b210c33a91ee9de41495a03a8bbff81f25be73b9
Author: Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2024-11-13 13:47:29 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2024-11-13 13:47:29 +0000
mv: Type and style nits.
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D47537
---
bin/mv/mv.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/bin/mv/mv.c b/bin/mv/mv.c
index 8aea4bbf567c..c3080112cee5 100644
--- a/bin/mv/mv.c
+++ b/bin/mv/mv.c
@@ -262,18 +262,19 @@ static int
fastcopy(const char *from, const char *to, struct stat *sbp)
{
struct timespec ts[2];
- static u_int blen = MAXPHYS;
+ struct stat tsb;
static char *bp = NULL;
+ static size_t blen = MAXPHYS;
+ ssize_t nread;
+ int from_fd, to_fd;
mode_t oldmode;
- int nread, from_fd, to_fd;
- struct stat tsb;
if ((from_fd = open(from, O_RDONLY, 0)) < 0) {
warn("fastcopy: open() failed (from): %s", from);
return (1);
}
- if (bp == NULL && (bp = malloc((size_t)blen)) == NULL) {
- warnx("malloc(%u) failed", blen);
+ if (bp == NULL && (bp = malloc(blen)) == NULL) {
+ warnx("malloc(%zu) failed", blen);
(void)close(from_fd);
return (1);
}
@@ -285,7 +286,7 @@ fastcopy(const char *from, const char *to, struct stat *sbp)
(void)close(from_fd);
return (1);
}
- while ((nread = read(from_fd, bp, (size_t)blen)) > 0)
+ while ((nread = read(from_fd, bp, blen)) > 0)
if (write(to_fd, bp, (size_t)nread) != nread) {
warn("fastcopy: write() failed: %s", to);
goto err;