Mercurial > hg
diff contrib/fuzz/pyutil.cc @ 43807:c78f8f0720cc
fuzz: fix an unused result on getcwd() in pyutil
clang was rightly complaining about this, so let's just fix it.
Differential Revision: https://phab.mercurial-scm.org/D7558
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 06 Dec 2019 15:30:29 -0500 |
parents | ef103c96ed33 |
children | 8766728dbce6 |
line wrap: on
line diff
--- a/contrib/fuzz/pyutil.cc Sun Sep 29 16:00:32 2019 +0200 +++ b/contrib/fuzz/pyutil.cc Fri Dec 06 15:30:29 2019 -0500 @@ -1,5 +1,6 @@ #include "pyutil.h" +#include <iostream> #include <string> namespace contrib @@ -24,7 +25,11 @@ auto pos = selfpath.rfind("/"); if (pos == std::string::npos) { char wd[8192]; - getcwd(wd, 8192); + if (!getcwd(wd, 8192)) { + std::cerr << "Failed to call getcwd: errno " << errno + << std::endl; + exit(1); + } pypath = std::string(wd) + subdir; } else { pypath = selfpath.substr(0, pos) + subdir;