linux-sandbox: Print a debug message when a remount failure is ignored.
Closes
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
+
#include <string>
#ifndef MS_REC
@@ -275,8 +276,17 @@ static void MakeFilesystemMostlyReadOnly() {
// mount is a broken NFS mount. In the ideal case, the user would either
// fix or remove that mount, but in cases where that's not possible, we
// should just ignore it.
- if (errno != EACCES && errno != EPERM && errno != EINVAL &&
- errno != ENOENT && errno != ESTALE) {
+ switch (errno) {
+ case EACCES:
+ case EPERM:
+ case EINVAL:
+ case ENOENT:
+ case ESTALE:
+ PRINT_DEBUG(
+ "remount(nullptr, %s, nullptr, %d, nullptr) failure (%m) ignored",
+ ent->mnt_dir, mountFlags);
+ break;
+ default:
DIE("remount(nullptr, %s, nullptr, %d, nullptr)", ent->mnt_dir,
mountFlags);
}
