From: "Darrick J. Wong" <djwong@kernel.org>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/4] xfs_quota: don't exit on fs_table_insert_project_path failure
Date: Sat, 11 Dec 2021 08:56:15 -0800 [thread overview]
Message-ID: <20211211165615.GG1218082@magnolia> (raw)
In-Reply-To: <7f51c3db-6f3e-be89-09cf-4e704b840440@sandeen.net>
On Fri, Dec 10, 2021 at 11:52:54PM -0600, Eric Sandeen wrote:
> On 12/10/21 6:21 PM, Darrick J. Wong wrote:
> > On Fri, Dec 10, 2021 at 02:21:36PM -0600, Eric Sandeen wrote:
> > > From: Eric Sandeen <sandeen@redhat.com>
> > >
> > > If "project -p" fails in fs_table_insert_project_path, it
> > > calls exit() today which is quite unfriendly. Return an error
> > > and return to the command prompt as expected.
> > >
> > > Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> > > Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
> > > ---
> > > libfrog/paths.c | 7 +++----
> > > libfrog/paths.h | 2 +-
> > > quota/project.c | 4 +++-
> > > 3 files changed, 7 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/libfrog/paths.c b/libfrog/paths.c
> > > index d679376..6c0fee2 100644
> > > --- a/libfrog/paths.c
> > > +++ b/libfrog/paths.c
> > > @@ -546,7 +546,7 @@ out_error:
> > > progname, strerror(error));
> > > }
> > > -void
> > > +int
> > > fs_table_insert_project_path(
> > > char *dir,
> > > prid_t prid)
> > > @@ -561,9 +561,8 @@ fs_table_insert_project_path(
> > > else
> > > error = ENOENT;
> > > - if (error) {
> > > + if (error)
> > > fprintf(stderr, _("%s: cannot setup path for project dir %s: %s\n"),
> > > progname, dir, strerror(error));
> >
> > Why not move this to the (sole) caller? Libraries (even pseudolibraries
> > like libfrog) usually aren't supposed to go around fprintfing things.
>
> I mean, that's a legit goal, but
>
> $ grep -rw "printf\|fprintf" libfrog/ | wc -l
> 55
>
> but ok, I can reduce it to 54 ;)
>
With that fixed,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> -Eric
next prev parent reply other threads:[~2021-12-11 16:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-10 20:21 [PATCH 0/4] xfsprogs: misc small fixes Eric Sandeen
2021-12-10 20:21 ` [PATCH 1/4] xfs_quota: document unit multipliers used in limit command Eric Sandeen
2021-12-11 0:15 ` Darrick J. Wong
2021-12-11 5:47 ` Eric Sandeen
2021-12-11 16:55 ` Darrick J. Wong
2021-12-10 20:21 ` [PATCH 2/4] mkfs.xfs(8): remove incorrect default inode allocator description Eric Sandeen
2021-12-11 0:19 ` Darrick J. Wong
2021-12-10 20:21 ` [PATCH 3/4] xfs_quota: don't exit on fs_table_insert_project_path failure Eric Sandeen
2021-12-11 0:21 ` Darrick J. Wong
2021-12-11 5:52 ` Eric Sandeen
2021-12-11 16:56 ` Darrick J. Wong [this message]
2021-12-10 20:21 ` [PATCH 4/4] xfs_repair: don't guess about failure reason in phase6 Eric Sandeen
2021-12-11 0:23 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211211165615.GG1218082@magnolia \
--to=djwong@kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@sandeen.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox