https://git.reactos.org/?p=reactos.git;a=commitdiff;h=84ed4a79dc6f5d913eace0...
commit 84ed4a79dc6f5d913eace09b1fdb57404d69dcf2 Author: Sergey Valentei ihsinme@gmail.com AuthorDate: Mon Oct 25 12:12:37 2021 +0300 Commit: Stanislav Motylkov x86corez@gmail.com CommitDate: Wed Nov 17 14:28:12 2021 +0300
[HHPCOMP] Check return value when calling chdir (#4073)
Signed-off-by: Sergey Valentei ihsinme@gmail.com --- sdk/tools/hhpcomp/hhpcomp.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sdk/tools/hhpcomp/hhpcomp.cpp b/sdk/tools/hhpcomp/hhpcomp.cpp index 7510a92eb12..18a8661c8af 100644 --- a/sdk/tools/hhpcomp/hhpcomp.cpp +++ b/sdk/tools/hhpcomp/hhpcomp.cpp @@ -56,7 +56,11 @@ int main(int argc, char** argv) string absolute_name = replace_backslashes(real_path(argv[1])); int prefixlen = absolute_name.find_last_of('/'); clog << prefixlen << endl; - chdir(absolute_name.substr(0, prefixlen).c_str()); // change to the project file's directory + if (chdir(absolute_name.substr(0, prefixlen).c_str()) == -1) // change to the project file's directory + { + cerr << "chdir: working directory couldn't be changed" << endl; + exit(0); + } hhp_reader project_file(absolute_name);
struct chmcFile chm;