pathfix.patch 710 B

12345678910111213141516171819202122232425
  1. We're seeing systems in the wild (e.g. ubuntu 20.04) which call
  2. with a dirfd set to the full filename and path set to "". Since
  3. this seems to be expected to work, handle it accordingly.
  4. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
  5. Upstream-Status: Pending
  6. Index: git/pseudo_client.c
  7. ===================================================================
  8. --- git.orig/pseudo_client.c
  9. +++ git/pseudo_client.c
  10. @@ -1549,8 +1549,12 @@ base_path(int dirfd, const char *path, i
  11. if (!path)
  12. return NULL;
  13. - if (!*path)
  14. +
  15. + if (!*path) {
  16. + if (dirfd != -1 && dirfd != AT_FDCWD)
  17. + return fd_path(dirfd);
  18. return "";
  19. + }
  20. if (path[0] != '/') {
  21. if (dirfd != -1 && dirfd != AT_FDCWD) {