Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/jobs/configure-checks/all.bats
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ compiler_assertions () {

compile_assertions_finished () {
assert_line " * CFLAGS..............: -g -O2 -Wall -Wformat -Wformat-security -pedantic -fstack-protector -fPIE -D_FORTIFY_SOURCE=2 -std=c11"
assert_line " * CXXFLAGS............: -g -O2 -Wall -Wformat -Wformat-security -pedantic -fstack-protector -fPIE -D_FORTIFY_SOURCE=2 -std=c++11"
assert_line " * CXXFLAGS............: -g -O2 -Wall -Wformat -Wformat-security -pedantic -fstack-protector -fPIE -D_FORTIFY_SOURCE=2 -std=c++20"
assert_line " * LDFLAGS.............: -fPIE -pie -Wl,-z,relro -Wl,-z,now"
}

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ if test "x$JUDGEHOST_BUILD_ENABLED" = xyes; then
AX_APPEND_LINK_FLAGS([-Wl,-z,now], DEF_LDFLAGS)

test "x$enable_CFLAGS_setting" = xyes && AC_SUBST(CFLAGS, "$DEF_CXFLAGS -std=c11")
test "x$enable_CXXFLAGS_setting" = xyes && AC_SUBST(CXXFLAGS, "$DEF_CXFLAGS -std=c++11")
test "x$enable_CXXFLAGS_setting" = xyes && AC_SUBST(CXXFLAGS, "$DEF_CXFLAGS -std=c++20")
test "x$enable_LDFLAGS_setting" = xyes && AC_SUBST(LDFLAGS, $DEF_LDFLAGS)
fi

Expand Down
28 changes: 13 additions & 15 deletions judge/evict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@

#include "lib.misc.h"

extern "C" {
#include "lib.error.h"
}
#include "lib.error.hpp"

#define PROGRAM "evict"
#define VERSION DOMJUDGE_VERSION "/" REVISION

extern int errno;
const char *progname;
std::string_view progname;

int be_verbose;
int show_help;
Expand Down Expand Up @@ -53,7 +51,7 @@ void evict_directory(const std::string& dirname) {

dir = opendir(dirname.c_str());
if (dir != NULL) {
if (be_verbose) logmsg(LOG_INFO, "Evicting all files in directory: %s", dirname.c_str());
if (be_verbose) logmsg(LOG_INFO, "Evicting all files in directory: {}", dirname);

/* Read everything in the directory */
while ( (entry = readdir(dir)) != NULL ) {
Expand All @@ -66,14 +64,14 @@ void evict_directory(const std::string& dirname) {
std::string entry_path = dirname + "/" + entry->d_name;
fd = open(entry_path.c_str(), O_RDONLY, 0);
if (fd == -1) {
warning(errno, "Unable to open file: %s", entry_path.c_str());
warning(errno, "Unable to open file: {}", entry_path);
continue;
}

if (fstat(fd, &s) < 0) {
if (be_verbose) logerror(errno, "Unable to stat file/directory: %s\n", entry_path.c_str());
if (be_verbose) logerror(errno, "Unable to stat file/directory: {}\n", entry_path);
if ( close(fd)!=0 ) {
warning(errno, "Unable to close file: %s", entry_path.c_str());
warning(errno, "Unable to close file: {}", entry_path);
}
continue;
}
Expand All @@ -83,21 +81,21 @@ void evict_directory(const std::string& dirname) {
} else {
/* evict this file from the cache */
if (posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED)) {
warning(errno, "Unable to evict file: %s\n", entry_path.c_str());
warning(errno, "Unable to evict file: {}\n", entry_path);
} else {
if (be_verbose) logmsg(LOG_DEBUG, "Evicted file: %s", entry_path.c_str());
if (be_verbose) logmsg(LOG_DEBUG, "Evicted file: {}", entry_path);
}
}

if ( close(fd)!=0 ) {
warning(errno, "Unable to close file: %s", entry_path.c_str());
warning(errno, "Unable to close file: {}", entry_path);
}
}
if ( closedir(dir)!=0 ) {
warning(errno, "Unable to close directory: %s", dirname.c_str());
warning(errno, "Unable to close directory: {}", dirname);
}
} else {
warning(errno, "Unable to open directory: %s", dirname.c_str());
warning(errno, "Unable to open directory: {}", dirname);
}
}

Expand All @@ -120,10 +118,10 @@ int main(int argc, char *argv[])
break;
case ':': /* getopt error */
case '?':
logmsg(LOG_ERR, "unknown option or missing argument `%c'", optopt);
logmsg(LOG_ERR, "unknown option or missing argument `{}`", (char)optopt);
break;
default:
logmsg(LOG_ERR, "getopt returned character code `%c' ??", (char)opt);
logmsg(LOG_ERR, "getopt returned character code `{}` ??", (char)opt);
}
}

Expand Down
Loading
Loading