mv: Type and style nits.

Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D47537
This commit is contained in:
Dag-Erling Smørgrav 2024-11-13 14:47:29 +01:00
parent 5c65a0a916
commit b210c33a91

View file

@ -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;
static char *bp = NULL;
mode_t oldmode;
int nread, from_fd, to_fd;
struct stat tsb;
static char *bp = NULL;
static size_t blen = MAXPHYS;
ssize_t nread;
int from_fd, to_fd;
mode_t oldmode;
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;