google/nsjail

Build fails on armv7l (32 bit)

goldstar611 opened this issue · 2 comments

While compiling on 32-bit Raspbian OS the following error causes the build to fail:

mnt.cc: In function ‘const string mnt::flagsToStr(long unsigned int)’:
mnt.cc:93:2: error: narrowing conversion of ‘18446744071562067968’ from ‘uint64_t’ {aka ‘long long unsigned int’} to ‘long unsigned int’ inside { } [-Wnarrowing]
  };
  ^
make: *** [Makefile:60: mnt.o] Error 1
make: *** Waiting for unfinished jobs....

nsjail/mnt.cc

Lines 90 to 93 in c7c0adf

#if defined(MS_NOUSER)
NS_VALSTR_STRUCT(MS_NOUSER),
#endif /* defined(MS_NOUSER) */
};

Replacing MS_NOUSER with 1<<31 allows the build to proceed without error.

diff --git a/mnt.cc b/mnt.cc
index 1a9835a..8abd66a 100644
--- a/mnt.cc
+++ b/mnt.cc
@@ -88,7 +88,7 @@ static const std::string flagsToStr(unsigned long flags) {
            NS_VALSTR_STRUCT(MS_ACTIVE),
 #endif /* defined(MS_ACTIVE) */
 #if defined(MS_NOUSER)
-           NS_VALSTR_STRUCT(MS_NOUSER),
+           NS_VALSTR_STRUCT(1<<31),
 #endif /* defined(MS_NOUSER) */
        };