summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-04-09 12:24:36 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-04-09 12:24:36 +0200
commit9047e0620b50a26838990fcae83c3d007c7e1d28 (patch)
tree0acdbf2dac0f9c61e75197398246eb7bf07d7904 /lib
parentd44e3d642171fa506dcc5a6c1b2babe6b4b813bf (diff)
parent747be0f2bbedcc3bc397ab8be289885ee24e0dbf (diff)
downloadbarebox-9047e0620b50a26838990fcae83c3d007c7e1d28.tar.gz
barebox-9047e0620b50a26838990fcae83c3d007c7e1d28.tar.xz
Merge branch 'for-next/misc'
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig10
-rw-r--r--lib/libfile.c18
2 files changed, 11 insertions, 17 deletions
diff --git a/lib/Kconfig b/lib/Kconfig
index 150d63b1ba..27f62461f0 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -63,7 +63,7 @@ config GENERIC_FIND_NEXT_BIT
config PROCESS_ESCAPE_SEQUENCE
def_bool n
-source lib/lzo/Kconfig
+source "lib/lzo/Kconfig"
config BCH
bool
@@ -129,13 +129,13 @@ config CRC8
when they need to do cyclic redundancy check according CRC8
algorithm. Module will be called crc8.
-source lib/gui/Kconfig
+source "lib/gui/Kconfig"
-source lib/fonts/Kconfig
+source "lib/fonts/Kconfig"
-source lib/logo/Kconfig
+source "lib/logo/Kconfig"
-source lib/bootstrap/Kconfig
+source "lib/bootstrap/Kconfig"
config PRINTF_UUID
bool
diff --git a/lib/libfile.c b/lib/libfile.c
index 089749253d..eb12d158d8 100644
--- a/lib/libfile.c
+++ b/lib/libfile.c
@@ -323,10 +323,9 @@ int copy_file(const char *src, const char *dst, int verbose)
{
char *rw_buf = NULL;
int srcfd = 0, dstfd = 0;
- int r, w;
+ int r;
int ret = 1, err1 = 0;
int mode;
- void *buf;
int total = 0;
struct stat srcstat, dststat;
@@ -370,18 +369,13 @@ int copy_file(const char *src, const char *dst, int verbose)
if (!r)
break;
- buf = rw_buf;
- while (r) {
- w = write(dstfd, buf, r);
- if (w < 0) {
- perror("write");
- goto out;
- }
- buf += w;
- r -= w;
- total += w;
+ if (write_full(dstfd, rw_buf, r) < 0) {
+ perror("write");
+ goto out;
}
+ total += r;
+
if (verbose) {
if (srcstat.st_size && srcstat.st_size != FILESIZE_MAX)
show_progress(total);