Skip to content

Commit 4db5449

Browse files
committed
fix: warnings in utils
1 parent 962e857 commit 4db5449

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/utils/conf-gen-utils.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,10 @@ void delete_all_old_yaml()
301301
cmd += ROOT_PATH;
302302
cmd += "config-*.yaml";
303303
log4cplus_info("cmd: %s", cmd.c_str());
304-
system(cmd.c_str());
304+
int result = system(cmd.c_str());
305+
if (result != 0) {
306+
log4cplus_error("Failed to execute command: %s, return code: %d", cmd.c_str(), result);
307+
}
305308
}
306309

307310
void dump_authority()
@@ -352,9 +355,9 @@ int main(int argc, char* argv[])
352355
int n = strncmp(drt->d_name, prefix, l);
353356
if (n == 0) {
354357
YAML::Node dtc_config;
355-
char filepath[260] = {0};
358+
char filepath[512] = {0};
356359
try {
357-
sprintf(filepath, "%s%s", conf_dir, drt->d_name);
360+
snprintf(filepath, sizeof(filepath), "%s%s", conf_dir, drt->d_name);
358361
log4cplus_info("loading file: %s", filepath);
359362
dtc_config = YAML::LoadFile(filepath);
360363
} catch (const YAML::Exception &e) {

0 commit comments

Comments
 (0)