From 7321708c669ffbca40b59ea6b38405c125cb0200 Mon Sep 17 00:00:00 2001 From: Rokas Puzonas Date: Sat, 6 Jan 2024 14:51:42 +0200 Subject: [PATCH] update formatting --- forking/simple.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/forking/simple.c b/forking/simple.c index 01328ac..7cbe148 100644 --- a/forking/simple.c +++ b/forking/simple.c @@ -13,15 +13,13 @@ int main() { memcpy(shmem, parent_message, sizeof(parent_message)); int pid = fork(); - if (pid == 0) { - printf("Child read: %s\n", (char*)shmem); - memcpy(shmem, child_message, sizeof(child_message)); - printf("Child wrote: %s\n", (char*)shmem); - + printf("Child read: %s\n", (char*)shmem); + memcpy(shmem, child_message, sizeof(child_message)); + printf("Child wrote: %s\n", (char*)shmem); } else { - printf("Parent read: %s\n", (char*)shmem); - sleep(1); - printf("After 1s, parent read: %s\n", (char*)shmem); + printf("Parent read: %s\n", (char*)shmem); + sleep(1); + printf("After 1s, parent read: %s\n", (char*)shmem); } }