csomh / rpms / rsync

Forked from rpms/rsync 4 years ago
Clone

Blame SOURCES/rsync-3.1.3-covscan.patch

f090e2
diff --git a/util.c b/util.c
f090e2
index fbbfd8ba..235afa82 100644
f090e2
--- a/util.c
f090e2
+++ b/util.c
f090e2
@@ -342,6 +342,7 @@ int copy_file(const char *source, const char *dest, int ofd, mode_t mode)
f090e2
 		if (robust_unlink(dest) && errno != ENOENT) {
f090e2
 			int save_errno = errno;
f090e2
 			rsyserr(FERROR_XFER, errno, "unlink %s", full_fname(dest));
f090e2
+			close(ifd);
f090e2
 			errno = save_errno;
f090e2
 			return -1;
f090e2
 		}
f090e2
diff --git a/lib/pool_alloc.c b/lib/pool_alloc.c
f090e2
index 5856d591..a70a3f1a 100644
f090e2
--- a/lib/pool_alloc.c
f090e2
+++ b/lib/pool_alloc.c
f090e2
@@ -49,15 +49,15 @@ pool_create(size_t size, size_t quantum, void (*bomb)(const char *), int flags)
f090e2
 {
f090e2
 	struct alloc_pool *pool;
f090e2
 
f090e2
-	if (!(pool = new0(struct alloc_pool)))
f090e2
-		return NULL;
f090e2
-
f090e2
 	if ((MINALIGN & (MINALIGN - 1)) != 0) {
f090e2
 		if (bomb)
f090e2
 			(*bomb)("Compiler error: MINALIGN is not a power of 2\n");
f090e2
 		return NULL;
f090e2
 	}
f090e2
 
f090e2
+	if (!(pool = new0(struct alloc_pool)))
f090e2
+		return NULL;
f090e2
+
f090e2
 	if (!size)
f090e2
 		size = POOL_DEF_EXTENT;
f090e2
 	if (!quantum)
f090e2
diff --git a/batch.c b/batch.c
f090e2
index 21c632fc..1ab66e90 100644
f090e2
--- a/batch.c
f090e2
+++ b/batch.c
f090e2
@@ -216,7 +216,7 @@ static void write_filter_rules(int fd)
f090e2
 void write_batch_shell_file(int argc, char *argv[], int file_arg_cnt)
f090e2
 {
f090e2
 	int fd, i, len, err = 0;
f090e2
-	char *p, filename[MAXPATHLEN];
f090e2
+	char *p, *p2, filename[MAXPATHLEN];
f090e2
 
f090e2
 	stringjoin(filename, sizeof filename,
f090e2
 		   batch_name, ".sh", NULL);
f090e2
@@ -267,7 +267,7 @@ void write_batch_shell_file(int argc, char *argv[], int file_arg_cnt)
f090e2
 				err = 1;
f090e2
 		}
f090e2
 	}
f090e2
-	if (!(p = check_for_hostspec(argv[argc - 1], &p, &i)))
f090e2
+	if (!(p = check_for_hostspec(argv[argc - 1], &p2, &i)))
f090e2
 		p = argv[argc - 1];
f090e2
 	if (write(fd, " ${1:-", 6) != 6
f090e2
 	 || write_arg(fd, p) < 0)