Bug 1779312 - Preliminary fixes to some misuses of SANDBOX_LOG_ERROR. r=glandium

Two minor things I noticed while converting the existing sandbox logging:

1. One call site was using %u, but that doesn't exist in this printf
   dialect, only %d; signedness is determined by the actual argument
   type via template magic.

2. POSIX functions that return an error number just return the number;
   there was one place that was negating it before use, as if it had
   come from the Linux syscall ABI.

Differential Revision: https://phabricator.services.mozilla.com/D152096
This commit is contained in:
Jed Davis 2022-07-27 19:41:04 +00:00
Родитель cdad5df9d3
Коммит 4fb97a1c3d
2 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -500,7 +500,7 @@ class SandboxPolicyCommon : public SandboxPolicyBase {
auto buf = reinterpret_cast<char*>(aArgs.args[2]);
auto size = static_cast<size_t>(aArgs.args[3]);
if (fd != AT_FDCWD && path[0] != '/') {
SANDBOX_LOG_ERROR("unsupported fd-relative readlinkat(%d, %s, %p, %u)",
SANDBOX_LOG_ERROR("unsupported fd-relative readlinkat(%d, %s, %p, %d)",
fd, path, buf, size);
return BlockedSyscallTrap(aArgs, nullptr);
}

Просмотреть файл

@ -463,7 +463,7 @@ static void RestoreSignals(const sigset_t* aOldSigs) {
// state right now:
int rv = pthread_sigmask(SIG_SETMASK, aOldSigs, nullptr);
if (rv != 0) {
SANDBOX_LOG_ERROR("pthread_sigmask (restore): %s", strerror(-rv));
SANDBOX_LOG_ERROR("pthread_sigmask (restore): %s", strerror(rv));
MOZ_CRASH("pthread_sigmask");
}
}