Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932818AbcKBRjD (ORCPT ); Wed, 2 Nov 2016 13:39:03 -0400 Received: from mout.web.de ([217.72.192.78]:61722 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755952AbcKBRjC (ORCPT ); Wed, 2 Nov 2016 13:39:02 -0400 Subject: Re: scripts/basic/fixdep: Complete error handling in print_cmdline() To: Masahiro Yamada References: <72e07814-56e9-505a-d660-91ff20b6efea@users.sourceforge.net> Cc: Jim Davis , linux-kbuild@vger.kernel.org, Michal Marek , LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <3e08ed31-b8bf-cba0-67f8-0a66d0cdeeb4@users.sourceforge.net> Date: Wed, 2 Nov 2016 18:38:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:sYed5T0x5Y4KtPob5f0xBkub4JOEPE8BKxr/rFd97EcY98qumqJ O9wI0nU/gNcSPXAfs+7fhLG3H6OKC/EAAL/0IRJOwTYSQ+GUnU1MK8Kixr9sr09aA9S3ECr NYIVu8KCqXJf+pEIZjwDOVv0QokDDVdkUq+pzcmO8CxUocNSNQzO71QjnFMhp+ETXcnrDnG smw8Duzzu5QV94At7wszA== X-UI-Out-Filterresults: notjunk:1;V01:K0:mCnABfm8WXA=:2hntSc8eOhvfZ/9W91hVgz YyjXsjpXkPFGfLsW2jF/YP5AQ5tboV8flNjDLBGG+c+8kqdRZdBQ1nEHqWmTxAnnTQ2h2hzm5 ZpAg9efZX4xPEtYcf2NFgdZHGc8dhMImYZmpr/KNLqEHtD7I9BFFNHKtlu7T9VOgNNEXlUhyX TxLm4NUAbeRFtki4crzFMkPer/RKhV5vh5ifk1knCw6pnP2s91+nD0C6351z8nJ49wq3r7rqp Hbnq0yUkVvg0zBYFWCzYRUXaJXXKYW8uIu+V0IBbVOaiZQKmRCS1lbvkDjMJFoElmod1GTTqL lfO4Z/hyN4dHSWl2KbDL49En+cjiUkB1fWSugHi23cdFjzvEjJTZjf9Qy2CIHyE1PllYO+aSj zMNdVEj7per82fIHT6lKQrzW0iURclbG5c0FhZ1z3pKG6CD5IAHN8Uqo+WPT8pBrvrO3r+jPK mW+1sC1YF0zP2A+yVlvkfZTiXByDCFXqXC69yHPeit43us6o8ioB/Za46mih/46VrrIv6SOUL r64TvXOLsIko/KLZMM8sl2RZ49pIgjxumpjEqVhOivifhL7vYTVm6qxsRx9sY/Jksvu0z/F6c RvG7SXNY7SHqX3fwtPtOZg0V3S5NJs93eWLdl0jiXsUFqnQZ2/ZtDnjJ2nWnHf+HMev0Q9g5w iuq14sKG4FA0fUJtm1psMz3fXJlEfTUy8L0n0aV/2lpKI9Hooza2hRkHY8rrJ3W7quDY79p0z fZHK6GbMBbtHh2HdrczvjETGud340PH8DPDmapLqULgDefwOGv5LhomNiZdkJtexHkqCHMYpz /GvvZFW Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 466 Lines: 15 >>> + if (printf("cmd_%s := %s\n\n", target, cmdline) < 10) { >> >> Rather than scatter fragile magic numbers, like 10, throughout the >> code, if you're hell-bent on checking for printf errors you could >> write a little wrapper function that hid the magic number and bundled >> up the errno stuff. > > > BTW, how the magic number "10" was calculated? Does the passed format string indicate how many characters should be printed at least? Regards, Markus