From 1a81e38b17144624415d252a521fd5a06079d681 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 11 Jan 2011 13:01:13 -0500 Subject: make new code like old code Variable declarations at top of function, separate from initialization. Use == 0 instead of ! for checking pointers. Consistent spacing around {, *, casts. Declare 0-parameter functions as (void) not (). Integer valued functions return -1 on failure, 0 on success. --- stressfs.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'stressfs.c') diff --git a/stressfs.c b/stressfs.c index 43f312b..5d4fee2 100644 --- a/stressfs.c +++ b/stressfs.c @@ -14,20 +14,19 @@ int main(int argc, char *argv[]) { - int i; + int fd, i; + char path[] = "stressfs0"; + printf(1, "stressfs starting\n"); - for(i = 0; i < 4; i++){ - if(fork() > 0){ + for(i = 0; i < 4; i++) + if(fork() > 0) break; - } - } printf(1, "%d\n", i); - char path[] = "stressfs0"; path[8] += i; - int fd = open(path, O_CREATE | O_RDWR); + fd = open(path, O_CREATE | O_RDWR); for(i = 0; i < 100; i++) printf(fd, "%d\n", i); close(fd); -- cgit v1.2.3