blob: 0be817e62de1bd960697711c8a58b7f44cba4d96 [file] [log] [blame]
Patrick Williams03514f12024-04-05 07:04:11 -05001From 0994b59dba9f248ad31cb7087046dc00b72cb4ea Mon Sep 17 00:00:00 2001
Patrick Williamsda295312023-12-05 16:48:56 -06002From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 21 Jan 2022 15:15:11 -0800
Patrick Williams03514f12024-04-05 07:04:11 -05004Subject: [PATCH 16/22] pass correct parameters to getdents64
Patrick Williamsda295312023-12-05 16:48:56 -06005
6Fixes
7../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]
8 n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size);
9 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10
11../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]
12 n = getdents64(fd, &buffer, sizeof(buffer));
13 ^~~~~~~
14
15Upstream-Status: Inappropriate [musl specific]
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com>
18---
19 src/basic/recurse-dir.c | 2 +-
20 1 file changed, 1 insertion(+), 1 deletion(-)
21
22diff --git a/src/basic/recurse-dir.c b/src/basic/recurse-dir.c
23index 5e98b7a5d8..aef065047b 100644
24--- a/src/basic/recurse-dir.c
25+++ b/src/basic/recurse-dir.c
26@@ -55,7 +55,7 @@ int readdir_all(int dir_fd,
27 bs = MIN(MALLOC_SIZEOF_SAFE(de) - offsetof(DirectoryEntries, buffer), (size_t) SSIZE_MAX);
28 assert(bs > de->buffer_size);
29
30- n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size);
31+ n = getdents64(dir_fd, (struct dirent*)((uint8_t*) de->buffer + de->buffer_size), bs - de->buffer_size);
32 if (n < 0)
33 return -errno;
34 if (n == 0)
35--
Patrick Williams03514f12024-04-05 07:04:11 -0500362.34.1
Patrick Williamsda295312023-12-05 16:48:56 -060037