On 5/11/20 10:32 AM, Christoph Hellwig wrote: > On Sat, May 09, 2020 at 12:18:42PM -0500, Eric Sandeen wrote: ... >> @@ -101,6 +101,42 @@ warn_help(void) >> "\n")); >> } >> >> +static uint32_t >> +id_from_string( >> + char *name, >> + int type) >> +{ >> + uint32_t id = -1; >> + >> + switch (type) { >> + case XFS_USER_QUOTA: >> + id = uid_from_string(name); >> + if (id == -1) >> + fprintf(stderr, _("%s: invalid user name: %s\n"), >> + progname, name); >> + break; >> + case XFS_GROUP_QUOTA: >> + id = gid_from_string(name); >> + if (id == -1) >> + fprintf(stderr, _("%s: invalid group name: %s\n"), >> + progname, name); >> + break; >> + case XFS_PROJ_QUOTA: >> + id = prid_from_string(name); >> + if (id == -1) >> + fprintf(stderr, _("%s: invalid project name: %s\n"), >> + progname, name); >> + break; >> + default: >> + ASSERT(0); >> + break; >> + } >> + >> + if (id == -1) >> + exitcode = 1; >> + return id; > > What about de-duplicating the error printk as well? Oh yeah, good idea, I'll do that and send V2. for some reason I always forget about handling things like this in this way. :) Thanks, -Eric