0001-pass-correct-parameters-to-getdents64.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536
  1. From dab02796780f00d689cc1c7a0ba81abe7c5f28d0 Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Fri, 21 Jan 2022 15:15:11 -0800
  4. Subject: [PATCH] pass correct parameters to getdents64
  5. Fixes
  6. ../git/src/basic/recurse-dir.c:57:40: error: incompatible pointer types passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'struct dirent *' [-Werror,-Wincompatible-pointer-types]
  7. n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size);
  8. ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  9. ../git/src/basic/stat-util.c:102:28: error: incompatible pointer types passing 'union (unnamed union at ../git/src/basic/stat-util.c:78:9) *' to parameter of type 'struct dirent *' [-Werror,-Wincompatible-pointer-types]
  10. n = getdents64(fd, &buffer, sizeof(buffer));
  11. ^~~~~~~
  12. Upstream-Status: Inappropriate [musl specific]
  13. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  14. Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com>
  15. ---
  16. src/basic/recurse-dir.c | 2 +-
  17. 1 file changed, 1 insertion(+), 1 deletion(-)
  18. diff --git a/src/basic/recurse-dir.c b/src/basic/recurse-dir.c
  19. index efa1797b7b..03ff10ebe9 100644
  20. --- a/src/basic/recurse-dir.c
  21. +++ b/src/basic/recurse-dir.c
  22. @@ -54,7 +54,7 @@ int readdir_all(int dir_fd,
  23. bs = MIN(MALLOC_SIZEOF_SAFE(de) - offsetof(DirectoryEntries, buffer), (size_t) SSIZE_MAX);
  24. assert(bs > de->buffer_size);
  25. - n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size);
  26. + n = getdents64(dir_fd, (struct dirent*)((uint8_t*) de->buffer + de->buffer_size), bs - de->buffer_size);
  27. if (n < 0)
  28. return -errno;
  29. if (n == 0)