mirror of
https://github.com/QingdaoU/Judger.git
synced 2024-12-29 16:31:42 +00:00
add some comment
This commit is contained in:
parent
ed3dc97ce2
commit
7017b1838a
6
runner.c
6
runner.c
@ -137,12 +137,14 @@ int run(struct config *config, struct result *result) {
|
||||
}
|
||||
|
||||
// read stdin from in file
|
||||
if (dup2(fileno(fopen(config->in_file, "r")), 0)) {
|
||||
// On success, these system calls return the new descriptor.
|
||||
// On error, -1 is returned, and errno is set appropriately.
|
||||
if (dup2(fileno(fopen(config->in_file, "r")), 0) == -1) {
|
||||
print("dup2 stdin failed");
|
||||
return DUP2_FAILED;
|
||||
}
|
||||
// write stdout to out file
|
||||
if (dup2(fileno(fopen(config->out_file, "w")), 1)) {
|
||||
if (dup2(fileno(fopen(config->out_file, "w")), 1) == -1) {
|
||||
print("dup2 stdout failed");
|
||||
return DUP2_FAILED;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user