From: Jérôme Benoit Date: Tue, 30 May 2017 14:42:15 +0000 (+0200) Subject: Give more explicit name to PID variables X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=eb2b442ac78d6d68707b28cc0c33cddcb7280d0f;p=TD_IML.git Give more explicit name to PID variables Signed-off-by: Jérôme Benoit --- 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));