aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/pseudo/files/pathfix.patch
blob: b3e63fa28fc052c4a54097c8eabb467423963cc3 (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
We're seeing systems in the wild (e.g. ubuntu 20.04) which call
with a dirfd set to the full filename and path set to "". Since
this seems to be expected to work, handle it accordingly.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Upstream-Status: Pending

Index: git/pseudo_client.c
===================================================================
--- git.orig/pseudo_client.c
+++ git/pseudo_client.c
@@ -1549,8 +1549,12 @@ base_path(int dirfd, const char *path, i
 
 	if (!path)
 		return NULL;
-	if (!*path)
+
+	if (!*path) {
+		if (dirfd != -1 && dirfd != AT_FDCWD)
+			return fd_path(dirfd);
 		return "";
+	}
 
 	if (path[0] != '/') {
 		if (dirfd != -1 && dirfd != AT_FDCWD) {