Give more explicit name to PID variables
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 30 May 2017 14:42:15 +0000 (16:42 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 30 May 2017 14:42:15 +0000 (16:42 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
TD1/part_one/exo.c

index 3eeb4c4bfd73d62519f672161db66df9463b8fc0..2ace704e3db23f3a9cccee1f5da3fd97c2e9ca1d 100644 (file)
@@ -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));