From owner-freebsd-doc@FreeBSD.ORG Wed Sep 9 14:20:01 2009 Return-Path: Delivered-To: freebsd-doc@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 727DD106566C for ; Wed, 9 Sep 2009 14:20:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 3AF0D8FC1A for ; Wed, 9 Sep 2009 14:20:01 +0000 (UTC) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n89EK1qx001243 for ; Wed, 9 Sep 2009 14:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n89EK1pK001242; Wed, 9 Sep 2009 14:20:01 GMT (envelope-from gnats) Resent-Date: Wed, 9 Sep 2009 14:20:01 GMT Resent-Message-Id: <200909091420.n89EK1pK001242@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-doc@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Gennady Proskurin Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 757A7106566B for ; Wed, 9 Sep 2009 14:14:16 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 63B9A8FC12 for ; Wed, 9 Sep 2009 14:14:16 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n89EEG6d087311 for ; Wed, 9 Sep 2009 14:14:16 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n89EEG6s087310; Wed, 9 Sep 2009 14:14:16 GMT (envelope-from nobody) Message-Id: <200909091414.n89EEG6s087310@www.freebsd.org> Date: Wed, 9 Sep 2009 14:14:16 GMT From: Gennady Proskurin To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: docs/138663: system(3) man page confuses users about "return value of 127" X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2009 14:20:01 -0000 >Number: 138663 >Category: docs >Synopsis: system(3) man page confuses users about "return value of 127" >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-doc >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Sep 09 14:20:00 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Gennady Proskurin >Release: >Organization: >Environment: FreeBSD gpr.nnz-home.ru 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r197009M: Wed Sep 9 12:14:52 MSD 2009 gpr@gpr.nnz-home.ru:/usr/obj/usr/src/freebsd-head.svn/sys/GPR amd64 >Description: from system(3) man page RETURN VALUES The system() function returns the exit status of the shell as returned by waitpid(2), or -1 if an error occurred when invoking fork(2) or waitpid(2). A return value of 127 means the execution of the shell failed. It should be clearly mentioned, that "return value of 127" applies to result of WEXITSTATUS() or something (termination status for a program), not to return value of system() itself. >How-To-Repeat: man 3 system read section "RETURN VALUES" >Fix: man from OpenBSD, for example: RETURN VALUES If a child process cannot be created, or the termination status of the shell cannot be obtained, system() returns -1 and sets errno to indicate the error. If execution of the shell fails, system() returns the termi- nation status for a program that terminates with a call of exit(127). >Release-Note: >Audit-Trail: >Unformatted: