mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Fix a few warnings
This commit is contained in:
committed by
Vinnie Falco
parent
9bbaa9a2ae
commit
353f32e6af
@@ -157,7 +157,7 @@ window (T* blob, int start, int count )
|
||||
|
||||
/** Calculated a windowed metric using bins.
|
||||
TODO Need reference (SMHasher?)
|
||||
*/
|
||||
*/
|
||||
template <class FwdIter>
|
||||
double
|
||||
windowed_score (FwdIter first, FwdIter last)
|
||||
@@ -169,8 +169,6 @@ windowed_score (FwdIter first, FwdIter last)
|
||||
while (static_cast<double>(size) / (1 << maxwidth) < 5.0)
|
||||
maxwidth--;
|
||||
double worst = 0;
|
||||
int worstStart = -1;
|
||||
int worstWidth = -1;
|
||||
std::vector <int> bins (1 << maxwidth);
|
||||
int const hashbits = sizeof(std::size_t) * CHAR_BIT;
|
||||
for (int start = 0; start < hashbits; ++start)
|
||||
@@ -185,12 +183,7 @@ windowed_score (FwdIter first, FwdIter last)
|
||||
{
|
||||
double score (detail::score (
|
||||
bins.data(), bins.size(), size));
|
||||
if (score > worst)
|
||||
{
|
||||
worst = score;
|
||||
worstStart = start;
|
||||
worstWidth = width;
|
||||
}
|
||||
worst = std::max(score, worst);
|
||||
if (--width < 8)
|
||||
break;
|
||||
for (std::size_t i = 0, j = bins.size() / 2; j < bins.size(); ++i, ++j)
|
||||
|
||||
@@ -73,10 +73,14 @@ bool Process::isRunningUnderDebugger()
|
||||
return beast_isRunningUnderDebugger();
|
||||
}
|
||||
|
||||
static void swapUserAndEffectiveUser()
|
||||
// TODO(tom): raisePrivilege and lowerPrivilege don't seem to be called. If we
|
||||
// start using them, we should deal with the return codes of setreuid() and
|
||||
// setregid().
|
||||
static bool swapUserAndEffectiveUser()
|
||||
{
|
||||
(void) setreuid (geteuid(), getuid());
|
||||
(void) setregid (getegid(), getgid());
|
||||
auto r1 = setreuid (geteuid(), getuid());
|
||||
auto r2 = setregid (getegid(), getgid());
|
||||
return !(r1 || r2);
|
||||
}
|
||||
|
||||
void Process::raisePrivilege() { if (geteuid() != 0 && getuid() == 0) swapUserAndEffectiveUser(); }
|
||||
|
||||
Reference in New Issue
Block a user