Skip to content

Commit

Permalink
Merge pull request scnu-socoding#152 from M1saka10010/master
Browse files Browse the repository at this point in the history
fix: judger code quality
  • Loading branch information
M1saka10010 authored Jan 27, 2024
2 parents a6f8813 + 8f842be commit 4f9dc26
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 2 additions & 1 deletion judge/src/judge.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ void write_log(const char *fmt, ...)
va_list ap;
char buffer[BUFFER_SIZE];
// sprintf(buffer, "%s/log/client.log", oj_home);
if (snprintf(buffer, BUFFER_SIZE, "%s/log/client.log", oj_home) < 0)
int snp = snprintf(buffer, BUFFER_SIZE, "%s/log/client.log", oj_home);
if (snp < 0 || snp >= BUFFER_SIZE)
{
write_log("buffer overflow");
}
Expand Down
3 changes: 0 additions & 3 deletions polygon/src/judge.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ void write_log(const char *fmt, ...)
{
write_log("buffer overflow!");
}
{
write_log("buffer overflow!");
}
FILE *fp = fopen(buffer, "ae+");
if (fp == NULL)
{
Expand Down

0 comments on commit 4f9dc26

Please sign in to comment.