From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIbUW-0001g2-S5 for qemu-devel@nongnu.org; Mon, 11 Jan 2016 07:22:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIbUR-0001s6-Ty for qemu-devel@nongnu.org; Mon, 11 Jan 2016 07:22:32 -0500 Received: from relay.parallels.com ([195.214.232.42]:48367) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIbUR-0001rZ-LG for qemu-devel@nongnu.org; Mon, 11 Jan 2016 07:22:27 -0500 References: <1452081699-11894-1-git-send-email-den@openvz.org> <1452081699-11894-2-git-send-email-den@openvz.org> <568D1B95.3080702@openvz.org> From: Yuriy Pudgorodskiy Message-ID: <56939B4F.8050407@virtuozzo.com> Date: Mon, 11 Jan 2016 15:08:47 +0300 MIME-Version: 1.0 In-Reply-To: <568D1B95.3080702@openvz.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2] create ga_run_program() helper for guest-set-user-password List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" Cc: qemu-devel@nongnu.org, Michael Roth On 1/6/2016 4:50 PM, Denis V. Lunev wrote: > hmmm.... > > Yur, > > it seems that you have re-invented the wheel with > > gboolean > > g_spawn_sync (/|const gchar > > *working_directory|/, > /|gchar > > **argv|/, > /|gchar > > **envp|/, > /|GSpawnFlags > > flags|/, > /|GSpawnChildSetupFunc > > child_setup|/, > /|gpointer > > user_data|/, > /|gchar > > **standard_output|/, > /|gchar > > **standard_error|/, > /|gint > > *exit_status|/, > /|GError > > **error|/); > > Not exactly. g_spawn_sync() wrapper cannot be used directly instead of my wrapper, because it does not support redirected stdin which is required to send data to chpasswd. g_spawn_async_with_pipes() can be used (with stdin), but it will not make code simpler. Most of command-posix.c calls fork/execv directly, and so does the wrapper I wrote.