Skip to content

Commit 19909c4

Browse files
committed
Correctly handle unshare call error status
Thanks Keyu Tao for reporting.
1 parent d66221b commit 19909c4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

judge/runguard.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,9 @@ int main(int argc, char **argv)
12171217

12181218
cgroup_create();
12191219

1220-
unshare(CLONE_FILES|CLONE_FS|CLONE_NEWIPC|CLONE_NEWNET|CLONE_NEWNS|CLONE_NEWUTS|CLONE_SYSVSEM);
1220+
if ( unshare(CLONE_FILES|CLONE_FS|CLONE_NEWIPC|CLONE_NEWNET|CLONE_NEWNS|CLONE_NEWUTS|CLONE_SYSVSEM)!=0 ) {
1221+
error(errno, "calling unshare");
1222+
}
12211223

12221224
/* Check if any Linux Out-Of-Memory killer adjustments have to
12231225
* be made. The oom_adj or oom_score_adj is inherited by child

0 commit comments

Comments
 (0)