summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/0001-pass-correct-parameters-to-getdents64.patch
blob: 03a29b5327f54a82985c723c720443b901cc4445 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From fbc10748c7c59d82024a4d35146b8dfef8d52927 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 21 Jan 2022 15:15:11 -0800
Subject: [PATCH 1/2] pass correct parameters to getdents64

Fixes
../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]
                n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size);
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../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]
        n = getdents64(fd, &buffer, sizeof(buffer));
                           ^~~~~~~

Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 src/basic/recurse-dir.c | 2 +-
 src/basic/stat-util.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/basic/recurse-dir.c b/src/basic/recurse-dir.c
index efa1797b7b..797285e3be 100644
--- a/src/basic/recurse-dir.c
+++ b/src/basic/recurse-dir.c
@@ -54,7 +54,7 @@ int readdir_all(int dir_fd,
                 bs = MIN(MALLOC_SIZEOF_SAFE(de) - offsetof(DirectoryEntries, buffer), (size_t) SSIZE_MAX);
                 assert(bs > de->buffer_size);
 
-                n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size);
+                n = getdents64(dir_fd, de->buffer + de->buffer_size, bs - de->buffer_size);
                 if (n < 0)
                         return -errno;
                 if (n == 0)
diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c
index efac7b002e..9e1fe7f5a0 100644
--- a/src/basic/stat-util.c
+++ b/src/basic/stat-util.c
@@ -99,7 +99,7 @@ int dir_is_empty_at(int dir_fd, const char *path) {
                         return fd;
         }
 
-        n = getdents64(fd, &buffer, sizeof(buffer));
+        n = getdents64(fd, (struct dirent *)&buffer, sizeof(buffer));
         if (n < 0)
                 return -errno;
 
-- 
2.34.1