adonis0147 commented on code in PR #15760: URL: https://github.com/apache/doris/pull/15760#discussion_r1068863861
########## be/src/util/bfd_parser.cpp: ########## @@ -102,9 +102,11 @@ BfdParser* BfdParser::create() { } char prog_name[1024]; - // Ignore unused return value - if (fscanf(file, "%1023s ", prog_name)) - ; + + if (fscanf(file, "%1023s ", prog_name) != 1) { + return nullptr; + } + Review Comment: Ditto. ########## be/src/http/action/pprof_actions.cpp: ########## @@ -228,9 +228,11 @@ void CmdlineAction::handle(HttpRequest* req) { return; } char buf[1024]; - // Ignore unused return value - if (fscanf(fp, "%1023s ", buf)) - ; + + if (fscanf(fp, "%1023s ", buf) != 1) { + return; + } + Review Comment: Maybe we should call `fclose` here, or use RAII to manage the `FILE` pointer. ########## be/src/util/pprof_utils.cpp: ########## @@ -66,9 +66,10 @@ Status PprofUtils::get_self_cmdline(std::string* cmd) { return Status::InternalError("Unable to open file: /proc/self/cmdline"); } char buf[1024]; - // Ignore unused return value - if (fscanf(fp, "%1023s ", buf)) - ; + + if (fscanf(fp, "%1023s ", buf) != 1) { + return Status::InternalError("get_self_cmdline read buffer failed"); + } Review Comment: Ditto. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org