[Bug 265184] gunion(8) create has exit code 1 on success

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 16 Jul 2022 17:27:38 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265184

--- Comment #6 from commit-hook@FreeBSD.org ---
A commit in branch main references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=90e29718cffcec987769ccbe39308357202c46d5

commit 90e29718cffcec987769ccbe39308357202c46d5
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2022-07-16 17:25:22 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2022-07-16 17:26:51 +0000

    Clarify when GEOM utilities exit with success or failure.

    Historically, GEOM utilities (gpart(8), gstripe(8), gmirror(8),
    etc) used the gctl_error() routine to report errors. If they called
    gctl_error() they would exit with EXIT_FAILURE, otherwise they would
    return with EXIT_SUCCESS. If they used gctl_error() to output an
    informational message, for example when run with the -v (verbose)
    option, they would mistakenly exit with EXIT_FAILURE. A further
    limitation of the gctl_error() function was that it could only be
    called once. Messages from any additional calls to gctl_error()
    would be silently discarded.

    To resolve these problems a new function, gctl_msg() has been added.
    It can be called multiple times to output multiple messages. It
    also has an additional errno argument which should be zero if it is
    an informational message or an errno value (EINVAL, EBUSY, etc) if
    it is an error. When done the gctl_post_messages() function should
    be called to indicate that all messages have been posted. If any
    of the messages had a non-zero errno, the utility will EXIT_FAILURE.
    If only informational messages (with zero errno) were posted, the
    utility will EXIT_SUCCESS.

    Tested by:   Peter Holm
    PR:          265184
    MFC after:   1 week

 lib/libgeom/geom_ctl.c   |  6 ++--
 sbin/geom/core/geom.c    |  5 +++-
 sys/geom/geom.h          |  2 +-
 sys/geom/geom_ctl.c      | 10 ++++++-
 sys/geom/union/g_union.c | 75 ++++++++++++++++++++++++++----------------------
 5 files changed, 57 insertions(+), 41 deletions(-)

-- 
You are receiving this mail because:
You are the assignee for the bug.