Reactos

[HHPCOMP] Check return value when calling chdir (#4073)

Signed-off-by: Sergey Valentei <ihsinme@gmail.com>

authored by

Sergey Valentei and committed by
Stanislav Motylkov
84ed4a79 51ce0c51

+5 -1
+5 -1
sdk/tools/hhpcomp/hhpcomp.cpp
··· 56 56 string absolute_name = replace_backslashes(real_path(argv[1])); 57 57 int prefixlen = absolute_name.find_last_of('/'); 58 58 clog << prefixlen << endl; 59 - chdir(absolute_name.substr(0, prefixlen).c_str()); // change to the project file's directory 59 + if (chdir(absolute_name.substr(0, prefixlen).c_str()) == -1) // change to the project file's directory 60 + { 61 + cerr << "chdir: working directory couldn't be changed" << endl; 62 + exit(0); 63 + } 60 64 hhp_reader project_file(absolute_name); 61 65 62 66 struct chmcFile chm;