Content-Type: multipart/mixed; boundary="===============8125984579784303380==" MIME-Version: 1.0 From: ramesh.thomas at intel.com Subject: [Accel-config] [PATCH v1 1/5] accel-config: Remove redundant function Date: Mon, 22 Feb 2021 15:27:52 -0500 Message-ID: <20210222202756.186121-2-ramesh.thomas@intel.com> In-Reply-To: 20210222202756.186121-1-ramesh.thomas@intel.com To: accel-config@lists.01.org List-ID: --===============8125984579784303380== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Ramesh Thomas The run_builtin function is not necessary for accel-config because it does not need the additional handling of pipes and sockets that the project it was derived from needed to. Signed-off-by: Ramesh Thomas --- util/main.c | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/util/main.c b/util/main.c index 5260c77..b95d468 100644 --- a/util/main.c +++ b/util/main.c @@ -81,43 +81,6 @@ int main_handle_options(const char ***argv, int *argc, c= onst char *usage_msg, return handled; } = -static int run_builtin(struct cmd_struct *p, int argc, const char **argv, - void *ctx) -{ - int status; - struct stat st; - - status =3D p->fn(argc, argv, ctx); - - if (status) - return status & 0xff; - - /* Somebody closed stdout? */ - if (fstat(fileno(stdout), &st)) - return 0; - /* Ignore write errors for pipes and sockets.. */ - if (S_ISFIFO(st.st_mode) || S_ISSOCK(st.st_mode)) - return 0; - - status =3D 1; - /* Check for ENOSPC and EIO errors.. */ - if (fflush(stdout)) { - fprintf(stderr, "write failure on standard output: %s", strerror(errno)); - goto out; - } - if (ferror(stdout)) { - fprintf(stderr, "unknown write failure on standard output"); - goto out; - } - if (fclose(stdout)) { - fprintf(stderr, "close failed on standard output: %s", strerror(errno)); - goto out; - } - status =3D 0; -out: - return status; -} - void main_handle_internal_command(int argc, const char **argv, void *ctx, struct cmd_struct *cmds, int num_cmds) { @@ -134,6 +97,6 @@ void main_handle_internal_command(int argc, const char *= *argv, void *ctx, struct cmd_struct *p =3D cmds+i; if (strcmp(p->cmd, cmd)) continue; - exit(run_builtin(p, argc, argv, ctx)); + exit(p->fn(argc, argv, ctx)); } } -- = 2.26.2 --===============8125984579784303380==--