From patchwork Thu Jun 8 20:21:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 773482 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wkH0758S8z9s7B for ; Fri, 9 Jun 2017 06:22:15 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MleetIBu"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=ZDZ5xrjFYl4mB6X+gLzg3QoQbp7P/bWiGjtIcVZqrN8=; b=Mle etIBu6sg9bs3oJEFS7wOw+TMOXKVQHwPpNRavKuOqTDKec9GF9n82hYL363UlDpZNDXp1uu/m8qzG iUsw5S1h8XFCbDaX408pMpYx4DLZzS8TbPuKse9or9/lalSFZ4rUj2p8yS3wI2dmh2W0w+FnmxkNn SS/nAm/iDeCbJ0sIM+1OOrbvCBfxLfKHKK7Vu/G77LAF1AYYxaxG/w9vWHYeHSprqIWnIXfJUtz9a vbHgyWr4ciEpXdesvfaB+fco7ta460PTAxlAU6D1LDBhm0NHZoTj+o1Vsmu3xJaJT8inNQrv98aqW KjDsxjJ4wfp3lB0pRtxWpGq54EYIkCg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dJ3w0-0001Wu-83; Thu, 08 Jun 2017 20:21:36 +0000 Received: from mail2.candelatech.com ([208.74.158.173]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dJ3vx-0001Vm-MR for hostap@lists.infradead.org; Thu, 08 Jun 2017 20:21:35 +0000 Received: from v-f24-64.candelatech.com (firewall.candelatech.com [50.251.239.81]) by mail2.candelatech.com (Postfix) with ESMTP id 7148D40A5A2; Thu, 8 Jun 2017 13:21:11 -0700 (PDT) From: greearb@candelatech.com To: hostap@lists.infradead.org Subject: [PATCH] wpa_cli: Don't buffer stdout. Date: Thu, 8 Jun 2017 13:21:09 -0700 Message-Id: <1496953269-28926-1-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 2.7.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170608_132133_767087_4A3B8718 X-CRM114-Status: UNSURE ( 6.47 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ben Greear MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Ben Greear I am trying to read from a wpa_cli process using a perl script, and it appears that wpa_cli was buffering output and so my script would not see events properly. This patch apepars to fix it. Signed-off-by: Ben Greear --- wpa_supplicant/wpa_cli.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c index 4cdc4fb..510f385 100644 --- a/wpa_supplicant/wpa_cli.c +++ b/wpa_supplicant/wpa_cli.c @@ -4410,6 +4410,11 @@ int main(int argc, char *argv[]) } } + /* Don't buffer stdout, we need to see events immediately as they + * happen. + */ + setbuf(stdout, NULL); + interactive = (argc == optind) && (action_file == NULL); if (interactive)