diff options
| author | 2012-02-26 19:44:14 +0100 | |
|---|---|---|
| committer | 2012-02-26 19:44:56 +0100 | |
| commit | bf30e08ec329479ebc231e3ad8018099f7a0bbb0 (patch) | |
| tree | 142c0f264a0d6b7b83984800fd4d5445788496ef | |
| parent | Aesthetics. (diff) | |
| download | Stripe-CTF-bf30e08ec329479ebc231e3ad8018099f7a0bbb0.tar.xz Stripe-CTF-bf30e08ec329479ebc231e3ad8018099f7a0bbb0.zip | |
In case fork bombs are going off, use tighter pid calculations.
| -rw-r--r-- | level06.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -11,17 +11,15 @@ int testfragment(const char *str) { int out[2]; pipe2(out, O_NONBLOCK); - if (fork()) { int status; close(out[1]); - wait(NULL); - while (getpgid(getpid() + 2) == getpid()) + status = wait(NULL); + while (getpgid(status + 1) == getpid()) usleep(100); status = read(out[0], NULL, 1); close(out[0]); return status == 0; - } else { int file; struct rlimit limit; |
