From 2f950de60301c5ad97535b9da17559fc50a39604 Mon Sep 17 00:00:00 2001 From: dteske Date: Wed, 20 Jun 2018 05:50:54 +0000 Subject: [PATCH] dpv(3): MFC r330943, r335264 r330943: Fix bad error messages from dpv(3) Before = dpv: <__func__>: posix_spawnp(3): No such file or directory After = dpv: : No such file or directory Most notably, show the 2nd argument being passed to posix_spawnp(3) so we know what path/cmd failed. Also, we don't need to have "posix_spawnp(3)" in the error message nor the function because that can [a] change and [b] traversed using a debugger if necessary. r335264: Fix comparison between pointer and char literal PR: misc/204252 Reported by: David Binderman Sponsored by: Smule, Inc. git-svn-id: svn://svn.freebsd.org/base/stable/10@335407 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- lib/libdpv/dialog_util.c | 5 ++--- lib/libdpv/dprompt.c | 2 +- lib/libdpv/util.c | 5 ++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/libdpv/dialog_util.c b/lib/libdpv/dialog_util.c index 21baf9860..f4d24150b 100644 --- a/lib/libdpv/dialog_util.c +++ b/lib/libdpv/dialog_util.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Devin Teske + * Copyright (c) 2013-2018 Devin Teske * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -328,8 +328,7 @@ dialog_spawn_gauge(char *init_prompt, pid_t *pid) posix_spawn_file_actions_addclose(&action, stdin_pipe[1]); error = posix_spawnp(pid, dialog, &action, (const posix_spawnattr_t *)NULL, dargv, environ); - if (error != 0) - err(EXIT_FAILURE, "%s: posix_spawnp(3)", __func__); + if (error != 0) err(EXIT_FAILURE, "%s", dialog); /* NB: Do not free(3) *dargv[], else SIGSEGV */ diff --git a/lib/libdpv/dprompt.c b/lib/libdpv/dprompt.c index e3d636a84..b4fdd9959 100644 --- a/lib/libdpv/dprompt.c +++ b/lib/libdpv/dprompt.c @@ -89,7 +89,7 @@ spin_char(void) { char ch; - if (spin_cp == '\0') + if (*spin_cp == '\0') spin_cp = spin; ch = *spin_cp; diff --git a/lib/libdpv/util.c b/lib/libdpv/util.c index 25fc1cb03..5750f810c 100644 --- a/lib/libdpv/util.c +++ b/lib/libdpv/util.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Devin Teske + * Copyright (c) 2013-2018 Devin Teske * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -100,8 +100,7 @@ shell_spawn_pipecmd(const char *cmd, const char *label, pid_t *pid) posix_spawn_file_actions_addclose(&action, stdin_pipe[1]); error = posix_spawnp(pid, shellcmd, &action, (const posix_spawnattr_t *)NULL, shellcmd_argv, environ); - if (error != 0) - err(EXIT_FAILURE, "%s: posix_spawnp(3)", __func__); + if (error != 0) err(EXIT_FAILURE, "%s", shellcmd); return stdin_pipe[1]; } -- 2.42.0