mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
mv: Type and style nits.
Sponsored by: Klara, Inc. Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D47537
This commit is contained in:
parent
5c65a0a916
commit
b210c33a91
1 changed files with 8 additions and 7 deletions
15
bin/mv/mv.c
15
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;
|
||||
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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue