From eb2b442ac78d6d68707b28cc0c33cddcb7280d0f Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 30 May 2017 16:42:15 +0200 Subject: [PATCH] Give more explicit name to PID variables MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- TD1/part_one/exo.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/TD1/part_one/exo.c b/TD1/part_one/exo.c index 3eeb4c4..2ace704 100644 --- a/TD1/part_one/exo.c +++ b/TD1/part_one/exo.c @@ -18,19 +18,20 @@ int main() { printf("Courant:\n"); show_proc_pids(); - pid_t rtf = fork(); + pid_t cpid = fork(); - if (rtf == -1) { + if (cpid == -1) { printf("Erreur de clonage\n"); exit(EXIT_FAILURE); - } else if (rtf == 0) { + } else if (cpid == 0) { printf("Fils:\n"); show_proc_pids(); exit(EXIT_FAILURE); } else { printf("Parent:\n"); show_proc_pids(); - pid_t rtw = wait(&status); + pid_t wpid = wait(&status); + printf("Fin du PID: %d\n", wpid); system("ps aux"); if (WIFEXITED(status)) { printf("Fils termine, status=%d\n", WEXITSTATUS(status)); -- 2.34.1