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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
https://invent.kde.org/utilities/filelight/-/merge_requests/42
https://invent.kde.org/utilities/filelight/-/merge_requests/42/diffs?commit_id=f35d454513f2fc39fea0a5af7c94977c1ffb37aa
DEV_BSIZE and S_BLKSIZE represent the same thing, but S_BLKSIZE isn't defined in musl libc, so use DEV_BSIZE instead.
---
autotests/directoryIteratorTest.cpp | 8 ++++----
src/posixWalker.cpp | 2 +-
src/posixWalker.h | 1 +
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/autotests/directoryIteratorTest.cpp b/autotests/directoryIteratorTest.cpp
index d50c32b..fece8dd 100644
--- a/autotests/directoryIteratorTest.cpp
+++ b/autotests/directoryIteratorTest.cpp
@@ -60,9 +60,9 @@ private Q_SLOTS:
#ifdef Q_OS_WINDOWS
QCOMPARE(file.size, 7682);
#elif defined(Q_OS_FREEBSD)
- QCOMPARE(file.size, 1 * S_BLKSIZE);
+ QCOMPARE(file.size, 1 * DEV_BSIZE);
#else
- QCOMPARE(file.size, 16 * S_BLKSIZE);
+ QCOMPARE(file.size, 16 * DEV_BSIZE);
#endif
if (withSymlink) {
@@ -83,9 +83,9 @@ private Q_SLOTS:
#ifdef Q_OS_WINDOWS
QCOMPARE(symlink.size, 7682);
#elif defined(Q_OS_FREEBSD)
- QCOMPARE(file.size, 1 * S_BLKSIZE);
+ QCOMPARE(file.size, 1 * DEV_BSIZE);
#else
- QCOMPARE(symlink.size, 16 * S_BLKSIZE);
+ QCOMPARE(symlink.size, 16 * DEV_BSIZE);
#endif
}
}
diff --git a/src/posixWalker.cpp b/src/posixWalker.cpp
index be6935f..6538408 100644
--- a/src/posixWalker.cpp
+++ b/src/posixWalker.cpp
@@ -99,7 +99,7 @@ void POSIXWalker::next()
S_ISFIFO(statbuf.st_mode) || S_ISSOCK(statbuf.st_mode);
m_entry.isDir = S_ISDIR(statbuf.st_mode);
m_entry.isFile = S_ISREG(statbuf.st_mode);
- m_entry.size = statbuf.st_blocks * S_BLKSIZE;
+ m_entry.size = statbuf.st_blocks * DEV_BSIZE;
break;
}
}
diff --git a/src/posixWalker.h b/src/posixWalker.h
index 4a78d52..ba72a98 100644
--- a/src/posixWalker.h
+++ b/src/posixWalker.h
@@ -7,6 +7,7 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/param.h>
#include <unistd.h>
#include <cerrno>
--
2.35.1
|