csomh / rpms / rsync

Forked from rpms/rsync 3 years ago
Clone

Blame SOURCES/rsync-3.1.3-covscan.patch

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