]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/srvrec.cc
reset HOME, USER(NAME), TMPDIR & SHELL in DropPrivileges
[apt.git] / apt-pkg / contrib / srvrec.cc
index be159bad932f40e08a046e96b2d83e1fac239ce1..327e59937eda49b4bfdaa66efae58f4ead07efbd 100644 (file)
@@ -185,7 +185,7 @@ SrvRec PopFromSrvRecs(std::vector<SrvRec> &Recs)
         [&I](SrvRec const &J) { return I->priority != J.priority; });
 
    // clock seems random enough.
-   I += clock() % std::distance(I, J);
+   I += std::max(static_cast<clock_t>(0), clock()) % std::distance(I, J);
    SrvRec const selected = std::move(*I);
    Recs.erase(I);