[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250407191206.GD6307@frogsfrogsfrogs>
Date: Mon, 7 Apr 2025 12:12:06 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: Ritesh Harjani <ritesh.list@...il.com>
Cc: Zorro Lang <zlang@...hat.com>,
"Nirjhar Roy (IBM)" <nirjhar.roy.lists@...il.com>,
fstests@...r.kernel.org, linux-ext4@...r.kernel.org,
linux-xfs@...r.kernel.org, ojaswin@...ux.ibm.com, zlang@...nel.org,
david@...morbit.com
Subject: Re: [PATCH v2 5/5] common: exit --> _exit
On Tue, Apr 08, 2025 at 12:16:42AM +0530, Ritesh Harjani wrote:
> Zorro Lang <zlang@...hat.com> writes:
<snip>
> > Yeah, nice catch! As the defination of _exit:
> >
> > _exit()
> > {
> > status="$1"
> > exit "$status"
> > }
> >
> > The
> > "
> > status=1
> > exit
> > "
> > should be equal to:
> > "
> > _exit 1
> > "
> >
> > And "_exit" looks not make sense, due to it gives null to status.
> >
> > Same problem likes below:
> >
> >
> > @@ -3776,7 +3773,7 @@ _get_os_name()
> > echo 'linux'
> > else
> > echo Unknown operating system: `uname`
> > - exit
> > + _exit
> >
> >
> > The "_exit" without argument looks not make sense.
> >
>
> That's right. _exit called with no argument could make status as null.
> To prevent such misuse in future, should we add a warning/echo message
> if the no. of arguments passed to _exit() is not 1?
Why not set status only if the caller provides an argument?
test -n "$1" && status="$1"
perhaps?
--D
> -ritesh
Powered by blists - more mailing lists