aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-connectivity/rdist/rdist-6.1.5/rdist-6.1.5-mkstemp.patch
blob: e49e3e4d1d5b2d3c6400b8fa24da099f3c71eb60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Upstream-Status: Inappropriate [1]

[1] Not the author, the patch is from:
http://vault.centos.org/5.8/os/SRPMS/rdist-6.1.5-44.src.rpm

--- rdist-6.1.5/src/server.c.mkstemp	2004-05-25 14:29:37.279312752 +0200
+++ rdist-6.1.5/src/server.c	2004-05-25 14:31:27.050744340 +0200
@@ -1479,11 +1479,18 @@
 			*file = '/';
 		}
 		fd = mkstemp(new);
-		if (fd < 0) {
+		/* 
+		 * Don't consider it a fatal error if mkstemp() fails
+		 * because parent directory didn't exist. (Missing 
+		 * parents are created later (in recvfile())
+		 */
+		if ((fd < 0) && (errno != ENOENT)) {
 			error("Cannot set file name.");
 			return;
+		} else if (fd >= 0) {
+			close(fd);
+			unlink(new); /* Or symlink() will fail */
 		}
-		close(fd);
 	}
 
 	/*