D7558: fuzz: fix an unused result on getcwd() in pyutil
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Fri Dec 6 20:50:59 UTC 2019
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
clang was rightly complaining about this, so let's just fix it.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D7558
AFFECTED FILES
contrib/fuzz/pyutil.cc
CHANGE DETAILS
diff --git a/contrib/fuzz/pyutil.cc b/contrib/fuzz/pyutil.cc
--- a/contrib/fuzz/pyutil.cc
+++ b/contrib/fuzz/pyutil.cc
@@ -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;
To: durin42, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list