Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
libpkg/backup_lib.c: check read() status in a better way
rilysh committed 2 years ago
commit b78016f67112e53f39a14fbd8f3ea36722030945
parent 5ea536d
1 file changed +1 -3
modified libpkg/backup_lib.c
@@ -141,7 +141,7 @@ backup_library(struct pkgdb *db, struct pkg *p, const char *path)
		goto out;
	}

-
	while (nread = read(from, buf, sizeof(buf)), nread > 0) {
+
	while ((nread = read(from, buf, sizeof(buf))) > 0) {
		outbuf = buf;
		do {
			nwritten = write(to, outbuf, nread);
@@ -174,6 +174,4 @@ out:
		close(from);
	if (to >= 0)
		close(to);
-

-
	return;
}