void-packages/srcpkgs/ncdu2/patches/explicit-cast.patch

24 lines
964 B
Diff

From e6cfacfa068bbe05873583e68eb82e668875d48c Mon Sep 17 00:00:00 2001
From: Yorhel <git@yorhel.nl>
Date: Sun, 2 Apr 2023 11:57:34 +0200
Subject: [PATCH] scan.zig: Add explicit cast for struct statfs.f_type
Hopefully fixes #221.
---
src/scan.zig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/scan.zig b/src/scan.zig
index 328bd86..76b8fea 100644
--- a/src/scan.zig
+++ b/src/scan.zig
@@ -60,7 +60,7 @@ fn isKernfs(dir: std.fs.Dir, dev: u64) bool {
if (kernfs_cache.get(dev)) |e| return e;
var buf: c_statfs.struct_statfs = undefined;
if (c_statfs.fstatfs(dir.fd, &buf) != 0) return false; // silently ignoring errors isn't too nice.
- const iskern = switch (buf.f_type) {
+ const iskern = switch (util.castTruncate(u32, buf.f_type)) {
// These numbers are documented in the Linux 'statfs(2)' man page, so I assume they're stable.
0x42494e4d, // BINFMTFS_MAGIC
0xcafe4a11, // BPF_FS_MAGIC