Date: Wed, 14 Mar 2018 19:23:17 +0000 (UTC) From: Devin Teske <dteske@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r330943 - head/lib/libdpv Message-ID: <201803141923.w2EJNHHa028446@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dteske Date: Wed Mar 14 19:23:17 2018 New Revision: 330943 URL: https://svnweb.freebsd.org/changeset/base/330943 Log: Fix bad error messages from dpv(3) Before = dpv: <__func__>: posix_spawnp(3): No such file or directory After = dpv: <path/cmd>: 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. Modified: head/lib/libdpv/dialog_util.c head/lib/libdpv/util.c Modified: head/lib/libdpv/dialog_util.c ============================================================================== --- head/lib/libdpv/dialog_util.c Wed Mar 14 19:18:35 2018 (r330942) +++ head/lib/libdpv/dialog_util.c Wed Mar 14 19:23:17 2018 (r330943) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Devin Teske <dteske@FreeBSD.org> + * Copyright (c) 2013-2018 Devin Teske <dteske@FreeBSD.org> * 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 */ Modified: head/lib/libdpv/util.c ============================================================================== --- head/lib/libdpv/util.c Wed Mar 14 19:18:35 2018 (r330942) +++ head/lib/libdpv/util.c Wed Mar 14 19:23:17 2018 (r330943) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Devin Teske <dteske@FreeBSD.org> + * Copyright (c) 2013-2018 Devin Teske <dteske@FreeBSD.org> * 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 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]; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803141923.w2EJNHHa028446>