LINUX.ORG.RU

История изменений

Исправление theNamelessOne, (текущая версия) :

на этом месте вопрос и возник «почему exec применяется именно к дочернему процессу?»

man fork.

RETURN VALUE

On success, the PID of the child process is returned in the parent, and 0 is returned in the child. On failure, -1 is returned in the parent, no child process is created, and errno is set appropriately.

А теперь посмотри, где выполняется exec.

Исходная версия theNamelessOne, :

на этом месте вопрос и возник «почему exec применяется именно к дочернему процессу?»

man fork.

RETURN VALUE

On success, the PID of the child process is returned in the parent, and 0 is returned in the child. On failure, -1 is returned in the parent, no child process is created, and errno is set appropriately.