mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-31 09:21:18 +02:00
helpers.cpp: fix narrowing conversion
switch expression is 'int', but f_type gets stored as 'long unsigned int' on 32-bit machines since it may not fit otherwise. Recent compilers diagnose this and bail out with: ../../../git/src/system/helpers.cpp:330:9: error: narrowing conversion of '2240043254' from 'long unsigned int' to 'int' [-Wnarrowing] casting the switch expression to long unsigned int seems to be the solution. in short: this fixes the build for 32-bit machines with gcc ≥ 10.x Signed-off-by: Markus Volk <f_l_k@t-online.de>
This commit is contained in:
@@ -326,7 +326,7 @@ int check_dir(const char * dir, bool allow_tmp)
|
||||
int ret = -1;
|
||||
struct statfs s;
|
||||
if (::statfs(dir, &s) == 0) {
|
||||
switch (s.f_type) {
|
||||
switch ((long unsigned int)s.f_type) {
|
||||
case 0x858458f6L: // ramfs
|
||||
case 0x1021994L: // tmpfs
|
||||
if(allow_tmp)
|
||||
|
Reference in New Issue
Block a user