From patchwork Mon Mar 21 22:54:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787865 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44B92C433F5 for ; Mon, 21 Mar 2022 23:09:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231654AbiCUXKo (ORCPT ); Mon, 21 Mar 2022 19:10:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233733AbiCUXI6 (ORCPT ); Mon, 21 Mar 2022 19:08:58 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD1CD3480D9 for ; Mon, 21 Mar 2022 15:57:12 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id h4so4689969wrc.13 for ; Mon, 21 Mar 2022 15:57:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gMJHN4hCuvbjypg9z1wj7Ld/HIu+BU8m4JtznGX15ys=; b=N8GYbi/aFMvVgiC+W6f6lMKwpI/+a+1jkEem7wVJX7qH1BwQMW/wVyprfjfdAiVVYJ sD8WNbAz57lknmc6LG688bsiX9jyTIKFvP/sGsP6W8LJK4vy72H/zz5qWW1Tp3a/iLzw G/2BQaZJNJ7Yzd/slI+NOtNQhCx0Gf1PlBL21IKycMXpYHncMzO2OzkPWadbQciwynBN n4y18N9rIP5fjM5JZRQJUp+ZeqmFaH8XTH2GZYOKTWcyenQVWNmTzQ/3X5dKS9BAMoZv CN8SEddT8ySg/9QWsIAU2bRx29hueerQVNZXl0W8TlpCKYrlb1LMGdwhCCJcCCCGeRM9 UELw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gMJHN4hCuvbjypg9z1wj7Ld/HIu+BU8m4JtznGX15ys=; b=e9R5CXTx8bOuPBNk4xz0TUVuTKV76Fx0n6Ew5OiXCGi/m1tdr5u8BJ6udNZ94gY3n3 yX5XTDN2u4bk+XeXBbRPK76AyfbgJkOWwGvvOo6VPDXCgiUIcbclbGPEKPf7d+WZsV1g b9KlITrYye2lFsLw7rANMETLMWOR66vI8akvAIbghaHbQqoQr8YzRRapathdj/bcANlw Bpdbj5tIkyn8wC+4FzyImoBrUCeQ3So0fb4cwj6SHYNTLNhiKTzvf+1v4RBsLqlAqSBc 6+RYHhZkzYcJpkYl28Cl8xVS+gbl7BKGCfMyUd69aPel0MqcUlZL1Jk4v7pQI2J3TI0j 4KkQ== X-Gm-Message-State: AOAM530hoV66z0XkwshiOmv5Gij3YQ8IglesvNF7WV9YWaHcU6qkkoZd jxCNOUF+ny43XRd8yvXINuhPvwV7uRU= X-Google-Smtp-Source: ABdhPJxUzxNU5k2sOQVwgqADEV/M5LvP4SquRVIklivWUS227BPC79fsFIApXT4sYlcL8MVRF4z86A== X-Received: by 2002:adf:d1cc:0:b0:203:e857:85b4 with SMTP id b12-20020adfd1cc000000b00203e85785b4mr18390040wrd.666.1647903342308; Mon, 21 Mar 2022 15:55:42 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:41 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 01/41] archive.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:54:43 +0000 Message-Id: <20220321225523.724509-2-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- archive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archive.c b/archive.c index e29d0e00f6..c8c1df59de 100644 --- a/archive.c +++ b/archive.c @@ -590,7 +590,7 @@ static int parse_archive_args(int argc, const char **argv, for (i = 0; i < nr_archivers; i++) if (!is_remote || archivers[i]->flags & ARCHIVER_REMOTE) printf("%s\n", archivers[i]->name); - exit(0); + exit(EXIT_SUCCESS); } if (!format && name_hint) From patchwork Mon Mar 21 22:54:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787858 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31662C433FE for ; Mon, 21 Mar 2022 23:08:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232312AbiCUXKS (ORCPT ); Mon, 21 Mar 2022 19:10:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233931AbiCUXJI (ORCPT ); Mon, 21 Mar 2022 19:09:08 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2265837DE5F for ; Mon, 21 Mar 2022 15:57:08 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id v22so8742441wra.2 for ; Mon, 21 Mar 2022 15:57:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GcAAMnxSYGQuJRI4FtntEMkQxb+m46GxWQIsUu2gRL0=; b=ZkYfcjfbklkd59c4oskqUsyePn9YdlF1y47Osz3etjK90TCQAStkyc5LyxVX25wDWT 2f98yl9Ajjz0WV8mwB60wsYqYKy22mHA/4HSHIdYrVDhiq7S8PYDpYzRXWkhz/ci5COF z0WY+bjLAigRljr9YTBr+qGozLFJXm/j3UYX4CpSO/XN8jjp23vyfnjQR8yOmp6cT/AJ eehBA6zudXGOX6gM/yJjS5vBeFJE2V6iWSgFPIJwtTfMibWdBvHGImoUcGJC4sYXmV+8 ZARxhF8+lvjuvoAMdEC/nqKVfPSSriu0w0SqvP/A2Rx8+twOdN3fFVv88+s5MZfOCDzj loiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GcAAMnxSYGQuJRI4FtntEMkQxb+m46GxWQIsUu2gRL0=; b=l0TmaG3XvodjhlrKDNCg2ArEf1EYuV6k1ibAcq1WnZy+1N1CAI7XkPAxaXz/ql7gRl QlQLxDrKFUaKFUs06pHwNU0g7lzr2zqCyDiN6HrcRyH7nysFql6aQ28unusFKhX724i/ O2pBBDBQQCItYoDeLPT42qR07fXdrHkrccO+FeWtaoO7QA5uraw66jxu+yuFH0ACl4DJ xu3LFytNBeYwANW6wH1/mgD7ShR/JqGeroxkgp5I4iWM4syhv83/4q4QOC2AK9CCmkXz Tf4z/CqCF/Os4nmYC7n2Xzk0vEAnzmXKqbvi/iLIDoVebY40TopYmOYOpmdEmHzLiKGW iSAw== X-Gm-Message-State: AOAM530Hjlt4EYlHAz1EZcseCKNEju4lg+ZNUcB9HPZTv0/LlKulm95Z gzR+0RSv55V873BzuiaeoXuti3geznY= X-Google-Smtp-Source: ABdhPJyUQ54w/8HzuRZK5ZBuUvUdhv8QClRRfWwnMNsnNMh1cp7/ggM0a0k3NKYCsWYll9nH1R7blw== X-Received: by 2002:adf:cc88:0:b0:203:f088:c9f5 with SMTP id p8-20020adfcc88000000b00203f088c9f5mr17096459wrj.312.1647903343210; Mon, 21 Mar 2022 15:55:43 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:42 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 02/41] branch.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:54:44 +0000 Message-Id: <20220321225523.724509-3-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- branch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/branch.c b/branch.c index 6b31df539a..7a28ccdbd2 100644 --- a/branch.c +++ b/branch.c @@ -260,7 +260,7 @@ static void setup_tracking(const char *new_ref, const char *orig_ref, string_list_append(tracking.srcs, orig_ref); if (install_branch_config_multiple_remotes(config_flags, new_ref, tracking.remote, tracking.srcs) < 0) - exit(-1); + exit(EXIT_FAILURE); cleanup: string_list_clear(&tracking_srcs, 0); @@ -388,7 +388,7 @@ static void dwim_branch_start(struct repository *r, const char *start_name, if (advice_enabled(ADVICE_SET_UPSTREAM_FAILURE)) { error(_(upstream_missing), start_name); advise(_(upstream_advice)); - exit(1); + exit(EXIT_FAILURE); } die(_(upstream_missing), start_name); } From patchwork Mon Mar 21 22:54:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787882 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9499DC433EF for ; Mon, 21 Mar 2022 23:10:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232417AbiCUXL3 (ORCPT ); Mon, 21 Mar 2022 19:11:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233934AbiCUXJI (ORCPT ); Mon, 21 Mar 2022 19:09:08 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 228C837DE73 for ; Mon, 21 Mar 2022 15:57:08 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id v22so8742487wra.2 for ; Mon, 21 Mar 2022 15:57:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ag0H3TBwts0PKbp1hELy5woRZ8DbBzPLtBivF32I2JM=; b=FSAqnA8gaGKW4dSZz3Ddpx7lEjPb9GNxpZedcWWlGwAwGaia67sfY3iq56ouGx+mS6 91v7gRXCV4DKWlV20IYil/Fzy7M5pVPysQQBS0gU3Ir0oK+Tp3EA602ZJ2hyM31bwRd0 x5IO7+jgk8R/SKha8Ayegc14e3PCssLJGgcYDM3VddBGY6S+8ZgapaDPq4KzChcOLTIy C4dNlmbyqqkDq+e1ZE6iWMOXQ3Yv5dW1ymUjZTrb+lTyHVfRmJmgDUT6D7tFK/IweujN w9tJIx0k37ZVN8MRbmkQ2T/kd5Ha272X7urjqh23NhlXZBIgLddvCU1rUTQm6xTib8v2 2VeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ag0H3TBwts0PKbp1hELy5woRZ8DbBzPLtBivF32I2JM=; b=CH5cMK3YbjifY0cRk3kF8Sx/cLuIzupmuRTz+p50WYOjLfltGSc0yYkn82rvzFgoNb gprikf0HuocTJnPap9VugSrPdxieyYJrURrT7sKHqHwaQQ0k0iwaSPLBMpzdrtJ88uCY oBtC7Dssq5sEp88VMvY08kAr3jcAT6wcFrce9qcL8GzJBE5n9eVYPd6Gr0Rstyf1wy/w HNxxUL0XKrFlDplqqVjEb/3XiwAafsC2i4gH0Y3DBqcaphINSt7V0TkdtRKOXPwkWuJC kGwV0KWMx8oL6GO6lfJrLCGH9pqjZBcPWbwiVkQYddgpL/8iV8HsQNddtzM0t5Ftm1AU rCSg== X-Gm-Message-State: AOAM530d0x75DSJiZp+9LpLlSCu89GxVrS+yKXTANXG8ksjBH0atLN9p P2rZ50LfrtLKJA9uak8kFCl7kuYRZkY= X-Google-Smtp-Source: ABdhPJxaujTqv9kHBcspri7EOalTCB2wagkvDr7y8aTjLqY+LfIB7V16aNzZDfpN9Tg8OlLrz6OAAw== X-Received: by 2002:a5d:6d83:0:b0:204:107d:ffe2 with SMTP id l3-20020a5d6d83000000b00204107dffe2mr5995282wrs.413.1647903343975; Mon, 21 Mar 2022 15:55:43 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:43 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 03/41] am.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:54:45 +0000 Message-Id: <20220321225523.724509-4-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/am.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/am.c b/builtin/am.c index 0f4111bafa..ac74bce555 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -1638,7 +1638,7 @@ static void do_commit(const struct am_state *state) struct strbuf sb = STRBUF_INIT; if (run_hooks("pre-applypatch")) - exit(1); + exit(EXIT_FAILURE); if (write_cache_as_tree(&tree, 0, NULL)) die(_("git write-tree failed to write a tree")); @@ -1841,7 +1841,7 @@ static void am_run(struct am_state *state, int resume) } if (run_applypatch_msg_hook(state)) - exit(1); + exit(EXIT_FAILURE); if (to_keep) goto commit; From patchwork Mon Mar 21 22:54:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787878 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CA7EC433F5 for ; Mon, 21 Mar 2022 23:09:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232296AbiCUXLT (ORCPT ); Mon, 21 Mar 2022 19:11:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233670AbiCUXIw (ORCPT ); Mon, 21 Mar 2022 19:08:52 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCC5A337C1E for ; Mon, 21 Mar 2022 15:57:10 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id t11so22679010wrm.5 for ; Mon, 21 Mar 2022 15:57:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dXFwnhAMF7hy+x/nrhGZsTsJVc6ASEBsQq4WBu6dRMc=; b=jVJMwSJmW/Skrb+/a7DSHcDBq9PpguXjV/6Ht5UqdPZjX4yjpRcvaZ9cCDZAOWskyK Q9xOEzO5eP90YN/ip+JzBqHAc1UR/bVZS3fqv5LCeInDs59sFFt/auA7E+gpC5ZaPaXi XbjI8iwidtjQ8jKMIQD6obvuLrB60gEQvn+oCwAO4q4p4YlDD7LEjakV8T/ZAhR5GSjs mRBmsY9K9Mna77OJqxk3IC4fcwkTGYH1cSXARznjWjIPCLa/PeAgtVx3vH47b/4vjhom jTerLf/YIRor1KzLRkORXVP15kEqhSMBkzgx9OUnBci6j1gROfbmT2nkr9FNjvOoHBom KFbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dXFwnhAMF7hy+x/nrhGZsTsJVc6ASEBsQq4WBu6dRMc=; b=I4d+21Rq/5NmVtRCY71tjXsM0S68H34r2zEUgejoW49PKDu7R4+/UEbPIGjYhqq5FX BNvUvjCO8bE79gPXbhPn1o3tVUzC9EyNZqj62oSofQJZcbsHJGqccokLJCfmCWUxN6WY JfYj+kLkkMbM8xJiWAYO+YhcrqYlidGpt/XfMJmEmM3qBcBsGaQYLk9WrID6qEAmAt84 vw3xhqaafBdO0D9hd8nuIVQv8tDLVjyS4oZ2AzS/YDWirnRsbyA5WknAlo65R4onJyCm Hlt7AFru8qLwX8H2mVI4U+ywveT+XJycaNZvXXdVTsX73al8yH5i3bTxK4ni3CWsWqVl E+sQ== X-Gm-Message-State: AOAM533rwjBz8qLt/SMSOu6uewaRrRQGkznooxzrA/w/yOUhHP+Df+jB raPliXqTmO1e9Lce+1zuDcz53qLHJPc= X-Google-Smtp-Source: ABdhPJz13HAtUFBzYLNvolUc67Ud7J+synfUB2TgfUOks0ET53sx63HM2R8khbkV7XgqaJAFopErlQ== X-Received: by 2002:a05:6000:188b:b0:204:109a:fbed with SMTP id a11-20020a056000188b00b00204109afbedmr6176304wri.569.1647903344806; Mon, 21 Mar 2022 15:55:44 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:44 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 04/41] blame.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:54:46 +0000 Message-Id: <20220321225523.724509-5-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/blame.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/blame.c b/builtin/blame.c index 8d15b68afc..9866e6c911 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -921,7 +921,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix) case PARSE_OPT_ERROR: exit(129); case PARSE_OPT_COMPLETE: - exit(0); + exit(EXIT_SUCCESS); case PARSE_OPT_DONE: if (ctx.argv[0]) dashdash_pos = ctx.cpidx; From patchwork Mon Mar 21 22:54:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787857 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C394C433EF for ; Mon, 21 Mar 2022 23:08:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231766AbiCUXKL (ORCPT ); Mon, 21 Mar 2022 19:10:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233790AbiCUXJA (ORCPT ); Mon, 21 Mar 2022 19:09:00 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B460450051 for ; Mon, 21 Mar 2022 15:57:09 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id m30so12816598wrb.1 for ; Mon, 21 Mar 2022 15:57:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=d2p6bfiW5VuLcAUsQl7oKZ4SFXFoVeZ7t5xiC+0hs1s=; b=CF39FG3Rcu+68ymLSsHICiBOSbqziCoo/tidIjOtzJTehztHEnEmB4J7Dyyklwj+tb CsKmiRNMfkGZTIfMk1pTEzeSZk7UwOo5QkPiOrX7KeBSoEi1v1wcxa7tJUgZG1NOr+Rh +h83dx77eb8mTaSgnc3QISxGFwJtiATo5vtfFLCfgQizBfYVo1BG8Ba8BEOIegQ6gXGK ZrcZc9XY7wdPi9eBahpZbXziQkZbuYfmwcHtQAmDiEL3Q0/P8tcfJUaWFtuMLGCPSbSq HaClXCwYd7T+iELbo9GMfEjCI/eL1oo6F2bO23/bQub34G00dPNL3kdaJz30fEcMYXFM WxbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d2p6bfiW5VuLcAUsQl7oKZ4SFXFoVeZ7t5xiC+0hs1s=; b=UsCqlzHbDhbHiUN1BEMNTJZpQ9Scq3LeMbPLNE+mkV0Z0qEgf7r5A8zfqnLIewQSq/ /6sx82ySY+Kk00pvS2ldyv7DCyXQ+XBD7plzP0uPgRkyHeVv5Xl6RykvmkODqPvqG6iP EwrySjgT/d0Hlq9aNeEcVOfl7DYb6Fx2OKqz7/9cJ/5OfNx0+SGtTwkUW5utIrReGI3i NJRfXpCZnEOBneDhQzFkXWRUpzryjfYiimMcfACN/tYwGWSIDVmq96uOP8H55ebrdsrc DjE8Mpg1UMEYvrJk6HxbeI917+ensdkG/IM1BjxR3sLuuNNVN3LeEULiQ4sFoirgrXnl nvhw== X-Gm-Message-State: AOAM5308p0u3s6nL0pE5V0yU1e5q166TCPYW/8XZPbzs4sZOb6v8ywOU hi6BGFwVYOsvEzDJ0Aznn9EF+kVHaZY= X-Google-Smtp-Source: ABdhPJy/PnrCy6uuetKp/3Fgit0G8KiSHKJ7OpC4bvnWKoJZDSsG9AT+keilsIVLiH+l+srn0HSJAg== X-Received: by 2002:a05:6000:1685:b0:204:483:77ab with SMTP id y5-20020a056000168500b00204048377abmr9674197wrd.295.1647903345735; Mon, 21 Mar 2022 15:55:45 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:45 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 05/41] commit.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:54:47 +0000 Message-Id: <20220321225523.724509-6-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/commit.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/builtin/commit.c b/builtin/commit.c index 009a1de0a3..13af49fdd2 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -496,7 +496,7 @@ static const char *prepare_index(const char **argv, const char *prefix, } if (list_paths(&partial, !current_head ? NULL : "HEAD", &pathspec)) - exit(1); + exit(EXIT_FAILURE); discard_cache(); if (read_cache() < 0) @@ -1081,7 +1081,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix, if (launch_editor(git_path_commit_editmsg(), NULL, env.v)) { fprintf(stderr, _("Please supply the message using either -m or -F option.\n")); - exit(1); + exit(EXIT_FAILURE); } strvec_clear(&env); } @@ -1785,12 +1785,12 @@ int cmd_commit(int argc, const char **argv, const char *prefix) if (message_is_empty(&sb, cleanup_mode) && !allow_empty_message) { rollback_index_files(); fprintf(stderr, _("Aborting commit due to empty commit message.\n")); - exit(1); + exit(EXIT_FAILURE); } if (template_untouched(&sb, template_file, cleanup_mode) && !allow_empty_message) { rollback_index_files(); fprintf(stderr, _("Aborting commit; you did not edit the message.\n")); - exit(1); + exit(EXIT_FAILURE); } if (fixup_message && starts_with(sb.buf, "amend! ") && @@ -1801,7 +1801,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix) if (message_is_empty(&body, cleanup_mode)) { rollback_index_files(); fprintf(stderr, _("Aborting commit due to empty commit message body.\n")); - exit(1); + exit(EXIT_FAILURE); } strbuf_release(&body); } From patchwork Mon Mar 21 22:54:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787886 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE23BC433EF for ; Mon, 21 Mar 2022 23:10:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231560AbiCUXLl (ORCPT ); Mon, 21 Mar 2022 19:11:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233754AbiCUXI6 (ORCPT ); Mon, 21 Mar 2022 19:08:58 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3CCF4BBA4 for ; Mon, 21 Mar 2022 15:57:13 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id p9so22620438wra.12 for ; Mon, 21 Mar 2022 15:57:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MX1goLsm5UdtODGaQviXS6GI4k8Bwq9p8iWNLzhjkk8=; b=hK84w3GeKxdV/+azoi/EoL3oRCMYg1dBHVVv7uxs/C8anzQ7HWHk4roxJHUubKMzaw 4L5ii6+kzRC8NVMEGS4omyyIpWgPAF1kyoOHnAjFx4sGZ6kQLKHA8yIRjWZ5tzim9Ayn 0lAxdW17dgkv0m4RTC51SR7fhmmY9L3ZEg3baJam9L3M8f1gejouPu9cV9BYsrzSZO6v 7g+gFTYkKjce6mdHx+StMidvIX4AgBHiLaiKp9CHkauaVgX1oJKhHmDR7NPkUg3a6UPH XeEXpZzWQt9/4wEl8A7PWBydCYnuni1AJi+4iPcQdzI7DpSlInMgkVFBVardNWfTx0G+ EDow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MX1goLsm5UdtODGaQviXS6GI4k8Bwq9p8iWNLzhjkk8=; b=XCxjtg9g942HHskyOpEO7YBF6QJLMHdLNwFAIyRhHST8S7y51eSwPnSfU9TNioPEKX WG1vJVcB6BPRHGpwCCUmkDWwCmsKFa4gqxzrNWAAZhPn3jliGzFWH+AkEho0qNVBbvTn vndum2XPhPkwzOnRLA5i32NC131L9+sVg+Z5oqcqCiO2fZZb5+gQOcmZHRnFODRmiD7M sDV3cAU8KyEPoL+lSOHEDZUmuhU0P7XNOv+y5erwKL/Nc2XLdp/Pvjzf3QDlRuHvn50Z LUFxT8inOpjhIntYfM2ZuYlHZzJzwx+NSDrKRT2KTKNROiwV6zknQ++Y8e/1byieai8D nI/A== X-Gm-Message-State: AOAM531c8q7a04NQmWR1Y5Q26NZr2YRvkrY0n4oNl2oRgYJSw6h7G+oZ 5ECLqEFgCLy5mfT6vftgeKNcfvFCTLk= X-Google-Smtp-Source: ABdhPJwbrffveuPFrIZp34b3Iupickr/hF7/s4YwrtFvK5mIrEeVes5WF94yowWxKTJwvnVQVZhV0A== X-Received: by 2002:adf:f14e:0:b0:203:e049:6829 with SMTP id y14-20020adff14e000000b00203e0496829mr19507588wro.386.1647903346560; Mon, 21 Mar 2022 15:55:46 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:46 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 06/41] credential-cache--daemon.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:54:48 +0000 Message-Id: <20220321225523.724509-7-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/credential-cache--daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/credential-cache--daemon.c b/builtin/credential-cache--daemon.c index 4c6c89ab0d..83441cad5e 100644 --- a/builtin/credential-cache--daemon.c +++ b/builtin/credential-cache--daemon.c @@ -138,7 +138,7 @@ static void serve_one_client(FILE *in, FILE *out) * process actually ends, which closes the socket and gives * them EOF. */ - exit(0); + exit(EXIT_SUCCESS); } else if (!strcmp(action.buf, "erase")) remove_credential(&c); From patchwork Mon Mar 21 22:54:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787854 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF046C433EF for ; Mon, 21 Mar 2022 23:06:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230203AbiCUXHY (ORCPT ); Mon, 21 Mar 2022 19:07:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231766AbiCUXHQ (ORCPT ); Mon, 21 Mar 2022 19:07:16 -0400 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3B2C23DEBA for ; Mon, 21 Mar 2022 15:57:47 -0700 (PDT) Received: by mail-wr1-f43.google.com with SMTP id q8so11294896wrc.0 for ; Mon, 21 Mar 2022 15:57:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7S49J4rNMrM1ov2+uazlPh/tM8brvFV6SbkvoU8GTe4=; b=bfCJ4hkTh3y83hUORGEWQ0twxUQThdl9Fqidbae3z9vyVStREdXJSbjeMMA4UfTJsp qAfW2uxiWgI8Z/KCXgbeX9iibZFyPEXXw32Mego3CnNj/ZFvb65/j9Ef/Y6w2qMBB4Dh FasiYaqxIy0vefsoXGOmZtxZcLVzZ2hqCRWtiXi6XjK84+dInmKKtsnBdFgdV+d4aq2m mj6hLpgbieA5IT14cAqTmo922+A3xSle4987CuLYwyCAyrRg6qs0pYtu33TFNYHcakGs 4Tk4VE1iX3fBRIFNARuerZKY+vKGNewrqOBIY4XLXpWMCMD5e0JIaXwJZlmS8sM10naI 7bgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7S49J4rNMrM1ov2+uazlPh/tM8brvFV6SbkvoU8GTe4=; b=KfZ7JSnrJEIpOjiedBxIFBLdkPSmbnf3oxeZWQcSVszrq+N5Pc0zWVs48/omBoCWeG Oylo21Yq9EVufD/eBOM29C0IRrWi/y9J31wuzdk4z5wAh2WPSqP9rJptxCUyvkCs9+V4 JpvY/7OSPpM1o9yrOuvaOrgbTejG7xOBFmzGWVtyrtDm8YMVyWhsdLr8esMCgCLa2KbT uREZC4TBbei329qIKJMNu4u++dHw/aVXooZ69/EcohAd3+HanO+nlLGON1kGZ3tp+gaS +f3i0G/Rdr7A+jKlXCq2iYtlZcgbBH7h215GdAK1ip1HWOmZR5ukd4KFZa9OJdcTpgF7 E5+g== X-Gm-Message-State: AOAM532/IJEKIWMiibaE04dgcN7zTAuGR9LKqUJmYtABfPGuUavvsPsb acK4oWTF9F91nRV/DmEjdfs1/TS0SEQ= X-Google-Smtp-Source: ABdhPJzIONCUshG0V24rV3b8kwXTMvT8K18n/yZE1qB6fGou2N2UdeaRQqsWfKoeBzU4SJOhyvHiMQ== X-Received: by 2002:a5d:64e5:0:b0:204:147a:5f4d with SMTP id g5-20020a5d64e5000000b00204147a5f4dmr5009769wri.225.1647903347374; Mon, 21 Mar 2022 15:55:47 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:47 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 07/41] help.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:54:49 +0000 Message-Id: <20220321225523.724509-8-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/help.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/help.c b/builtin/help.c index 222f994f86..e5ca9d4a6e 100644 --- a/builtin/help.c +++ b/builtin/help.c @@ -554,7 +554,7 @@ static const char *check_git_cmd(const char* cmd) if (!exclude_guides || alias[0] == '!') { printf_ln(_("'%s' is aliased to '%s'"), cmd, alias); free(alias); - exit(0); + exit(EXIT_SUCCESS); } /* * Otherwise, we pretend that the command was "git From patchwork Mon Mar 21 22:54:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787892 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48E0AC433F5 for ; Mon, 21 Mar 2022 23:15:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232387AbiCUXRJ (ORCPT ); Mon, 21 Mar 2022 19:17:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232301AbiCUXRC (ORCPT ); Mon, 21 Mar 2022 19:17:02 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00D853FF263 for ; Mon, 21 Mar 2022 16:05:04 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id m26-20020a05600c3b1a00b0038c8b999f58so441819wms.1 for ; Mon, 21 Mar 2022 16:05:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SOEuVXiqSam2kqqMaWZHSLDegqfhDXwGWbk2ZzjuXcw=; b=q0nTExE9LmRYLTflbQl48oUsclrt4SWblmKqt6pNUDshS7GgPKTB3jNIWsv3adCNvP SEkg2bj5DqCR6XhJAh7xKpu9gfGclz2/Q+VuIPqwgTXeaubEDD2/pO0GgM797LNi8YOg suvpW9NTWzLO2UlP/V/VIv9RJapNt5eLq0FX0SHvzaIAvtKtGOoyPfrNZFSXDHMCyvJg SwLTUPxtsXaANyWjPUqtfr8F4WySCSgJogneU/JqDUBEhpMQI7njaI6kusqujHbmhSl+ hJ9P2TUXVFMEP+aSftT8dlg2Hf/yOOERevynGhSc2koIPEV+HVqd133YD2IyAGilGtf4 0LKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SOEuVXiqSam2kqqMaWZHSLDegqfhDXwGWbk2ZzjuXcw=; b=lnLTEsReNycqnG6Ayi7g28VHvrMiooON7x4kY9hcYsok4SvIRzBKaz/m/YNt0+BHpt 4NrFpdV4G8nywmx9IqO927aenHB1AIbtwt8IXM+7fUv/PDXIdYUOtmzEOwB4ecaIHcKH TUeF6HG0yqRZPmR3HXUt4p9lzV5RtOwJ60OzKcyK+vk30pNccYN58phU2OBUvqa6Shsp SSF+UnffuMSxVpUZ4n4dsoVpiYH3Rd9hgiuZf/M9j43LJYZCK4OtrtqZTMGm9b0HwMAc /pIaaI9eqffQs1na5Mx1FbmsOCbmpI46+bnuJ0tQzzkGXJX7OrTbDnGky7ocrsT3SSRc J3wA== X-Gm-Message-State: AOAM532tAlxgJCZTwGPT/X7f6+hqiGD3NVyM8jv3I0WL63ZbXrHQzSCa kU9hX91zj4MTHgoowaibx1zywPqbC1I= X-Google-Smtp-Source: ABdhPJy0X4l9QJ0BPuZg3+sj+BXDWcDTRDFUzHpW+R1tkkIHM/vnhEkgDsfbVJTqVMFs1M2Vv1YLVA== X-Received: by 2002:a05:600c:378d:b0:38b:e12f:edde with SMTP id o13-20020a05600c378d00b0038be12feddemr1111163wmr.69.1647903348309; Mon, 21 Mar 2022 15:55:48 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:48 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 08/41] init-db.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:54:50 +0000 Message-Id: <20220321225523.724509-9-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/init-db.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/init-db.c b/builtin/init-db.c index 546f9c595e..d8ddc04b96 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -264,7 +264,7 @@ static int create_default_files(const char *template_path, initial_branch); if (create_symref("HEAD", ref, NULL) < 0) - exit(1); + exit(EXIT_FAILURE); free(ref); } From patchwork Mon Mar 21 22:54:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787868 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91482C433EF for ; Mon, 21 Mar 2022 23:09:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232073AbiCUXKv (ORCPT ); Mon, 21 Mar 2022 19:10:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233789AbiCUXJA (ORCPT ); Mon, 21 Mar 2022 19:09:00 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DFC83B5025 for ; Mon, 21 Mar 2022 15:57:15 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id q8so11294965wrc.0 for ; Mon, 21 Mar 2022 15:57:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9YqNh3kdxe+Wvy/MZM4MclSUNX55FdTMPxhaEFXtHnQ=; b=Z3z9AeBpyeyTIVNV31jMnzUCrlOO+90/BNf2z081RAEJvhWQB61fTJew9zjAdoEeOi jhNcpaDCQ4vBeqdIJDIL9J98SLmBKAuhmEvYkFCRyZ1q88BC3RDrkFCLb21ZvZpNSD+q QHVzcOrxfYTjd7gsKRVFdbFv6dB5rPsQ5xvJNCHigmSXhiVIvbU1Dcce7CqFzKKUDGj2 XDJsbJ/Zr8BGJZvlSFb4jrQ5d/LtGXznwNu7JWVj5mQzVq7jsRgVWJaIDHZwXZMQ9cFB Z4MyPVdnr5P38DhyT0ffVAyW/e4yhobDrLOz/QlZhht9r+jB4owuNMeB5i/8W+2ghRCE YCtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9YqNh3kdxe+Wvy/MZM4MclSUNX55FdTMPxhaEFXtHnQ=; b=zKB9E24gRwHm1zP1rKUhm1YLWo2lwGFesy3qJ3Xz0Q1I2PHyHeUG7dbfio070sh8mz b75o+KTNekExXb6xvprC7YHfbCe90ECkNsYA1WDJCDypF4xV1wb5W9j48LlTkx8s3nl1 sFFy4LM+BwjalN+ivFh4lbNOG3g6sQwAu/vQMgLxIr838Mv0j1P4L421ZXD1Zq7ODU7T B9lGHx0HlUz6CkjPTNMpf+a5w/X3812bObORWQJdtVQqbUflk8nQLhKHeA424zhLK8ax wRbnczz2UF2ian4FVpcbRevZgQOF3JHy8pIvDFIEBvK+l9tX/4mvzkTmZfLKBM6b6jTV w7RQ== X-Gm-Message-State: AOAM532n6ICpAXiixKMPzdO5pzupEBVM0MAbROJeG6QSjouHUphZWzAg ogmAOjoO8b7ZqL3nfTR7J+NcCTbbbCE= X-Google-Smtp-Source: ABdhPJxT07oob67T+ew21YFwBYySiTpdLv5d8B4nHu2dherluoApx8trPFTK7xYqBKMWs74SpUOOhQ== X-Received: by 2002:adf:ef48:0:b0:1f0:47ba:d4e6 with SMTP id c8-20020adfef48000000b001f047bad4e6mr20509460wrp.438.1647903349201; Mon, 21 Mar 2022 15:55:49 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:48 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 09/41] mailsplit.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:54:51 +0000 Message-Id: <20220321225523.724509-10-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/mailsplit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c index 7baef30569..9127ac49e3 100644 --- a/builtin/mailsplit.c +++ b/builtin/mailsplit.c @@ -73,7 +73,7 @@ static int split_one(FILE *mbox, const char *name, int allow_bare) if (is_bare && !allow_bare) { fprintf(stderr, "corrupt mailbox\n"); - exit(1); + exit(EXIT_FAILURE); } fd = xopen(name, O_WRONLY | O_CREAT | O_EXCL, 0666); output = xfdopen(fd, "w"); From patchwork Mon Mar 21 22:54:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787888 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E93C3C433FE for ; Mon, 21 Mar 2022 23:10:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232344AbiCUXLp (ORCPT ); Mon, 21 Mar 2022 19:11:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233472AbiCUXIo (ORCPT ); Mon, 21 Mar 2022 19:08:44 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76AFE217957 for ; Mon, 21 Mar 2022 15:57:15 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id j18so13024259wrd.6 for ; Mon, 21 Mar 2022 15:57:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/cyaSgQCTA5gZ6CvxqC6/5tlKYEYq3tmxpt5d28Uy7E=; b=KJUoP7pegDMFLoQEEHhxU3+XokxrnGVSIhmxNE9PE78EN228PfjjboDT2i+IkUX05z FrxBnagPsvF8OhUjaHWX1GIEA2H0Nq8iTnvJkESVGKOFqZKt+CT8uRYvDwQZWoBXhdDB W8eUxoEsW37WU/5u6uP1a/wVjguLpS5OMVnk5OOr3dzJ0ol3tyHWQbXL358eL1jP9OnV dOk3NR8OopbcYL5DnyvXRTuoAV39GPY6Lj38eJWIko1MaGaS+6Ci+HJN3KAdwgcFBRBN Ie8Hsk4ZLoOe0EghTTY6Z1iZ3zUJ8PccEvvBja9kc7b9ZmixePLzJI9mQ51b5tjKGgi+ OAeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/cyaSgQCTA5gZ6CvxqC6/5tlKYEYq3tmxpt5d28Uy7E=; b=R6SlODtduMK5t9lYa1j2OgxsCbsbjGgbQWm4mOv0BqtIK4+PJGiSTaVjQ8XBHTSu2a Lpatz6VTaH6SAuLm/qNpXzbLm0jWs2teslY5xoImYPQYUaOJ0YyOEHBHrG8StGZmgS76 r9Fj5YW0Qux7BSo0929eXm2VAnLKn82nxaGMHl4xF8hqIJk8dKz3SEWstz4DscrKFn+t zpPZ7l8Qeo/a2EixvUdJWOk6o+2p+oTRuWRQWhP9qZlUaCWoJj7MjxVa4WsF+vXnClP4 Sbglh2C8oKkwKK1ugu16qnTJbmoK3qbJ6xXDLqxaythcnuoU3VKlHfK3H0me98+/EgPe 2xCg== X-Gm-Message-State: AOAM532LdIHtv3fGr55tBLe5fjHthNJq2pgHlofgXIVDI0SiOGhE0YvV 4DCteKhUWVcJBB9V42kskqUJo0X6Ofg= X-Google-Smtp-Source: ABdhPJydLfIo1G2q/JvrSKpMCUp/KcViIEiH+r9l6Q6LpqFinRiPG9hGrddyPZG3Q0xC4cU6ejFWAQ== X-Received: by 2002:a05:6000:178b:b0:204:f77:c0c with SMTP id e11-20020a056000178b00b002040f770c0cmr6470673wrg.150.1647903350064; Mon, 21 Mar 2022 15:55:50 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:49 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 10/41] merge-index.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:54:52 +0000 Message-Id: <20220321225523.724509-11-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/merge-index.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/merge-index.c b/builtin/merge-index.c index c0383fe9df..efa7ceaa35 100644 --- a/builtin/merge-index.c +++ b/builtin/merge-index.c @@ -37,7 +37,7 @@ static int merge_entry(int pos, const char *path) else { if (!quiet) die("merge program failed"); - exit(1); + exit(EXIT_FAILURE); } } return found; From patchwork Mon Mar 21 22:54:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787870 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BD9EC433EF for ; Mon, 21 Mar 2022 23:09:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232254AbiCUXK6 (ORCPT ); Mon, 21 Mar 2022 19:10:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233352AbiCUXIi (ORCPT ); Mon, 21 Mar 2022 19:08:38 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB734362D28 for ; Mon, 21 Mar 2022 15:57:24 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id bg31-20020a05600c3c9f00b00381590dbb33so369080wmb.3 for ; Mon, 21 Mar 2022 15:57:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mu/Th0tGJOW1Vp1fsRYv6sLwO9GVl//Pif1H+pKAEMQ=; b=MlUTeCKXSNfYWp/hlYJYnOD5AqJ1r7S/AWpidk8az35BFUkgSwGR0TPrBITEwAz2Ki CRi5F/2zO7ctrpdSWI11soM9JOpQzhYgx5WZCUq16M3qlsHzWqftcQ96xI3AlV9xmiCw 9d8QGK+fRhAnDKtP71ihX7XCn42ZxfgjuN2W+izhUMhCkdXWWhxzerlQ6PL8cWq1w+ph YIh6gTAPGZQanvp7Ycr82KQJUN3NdosPGpxXbY+3FQXbEsBgrRDGRmPd5gcbJhHLgQl3 6xZzLS9uiby62b9fo8oyQs+CqAQoVuwUUUUuVtbmADpRRti0Wj5NYl3UzcWczTw+Y1t3 wxQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mu/Th0tGJOW1Vp1fsRYv6sLwO9GVl//Pif1H+pKAEMQ=; b=EKFhoZa8eGkO1NY7BtOuR8xBRE/UrInIrLccxBR4TEOiPIhGPFayCVrBen6XmftbyA GdTw4ryARi1EwQyQ5eEklj1i2hI0W1Qdw2u/CRGlGJ8p//ANQxkVUuM1yA6oPc1fTixJ 62q3fdtK73Rd9GCK5M4Px4zcAZC6tKRIiBLtZeK+wHAN3NuJRaoBYkrEZHJCBkjDp7rH 8qknfuLELmv2RNXJ0PTvRlKoW7V3And6ZWpgzwoDPtfACHSfTwYqLSqe7AdJjuYaAcqW s182WcFL+unHo4aCpQ/tj74ZJORvBJbZiPN/JWBEXu+Law7+lQvuR6pbssEaYEht0KC1 hIYg== X-Gm-Message-State: AOAM533EaJhMeIA+czwe9Sxn4Pt/AMsb+TBE8eKep5hoV7KAgFBg7QQd oVN4a3w9CZiAo1N3FYRFXDj1jQDavcg= X-Google-Smtp-Source: ABdhPJwByFocfBpa3uE43ULnAsKk5eNqox+XFJ1RQmAXpOOtoKgbSq8mEikocaUjur7YwJDDDPW1xw== X-Received: by 2002:a7b:c350:0:b0:38c:6d3c:6c8 with SMTP id l16-20020a7bc350000000b0038c6d3c06c8mr1094761wmj.45.1647903350968; Mon, 21 Mar 2022 15:55:50 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:50 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 11/41] merge.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:54:53 +0000 Message-Id: <20220321225523.724509-12-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/merge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/merge.c b/builtin/merge.c index f178f5a3ee..3bb6f902f0 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -209,7 +209,7 @@ static struct strategy *get_strategy(const char *name) fprintf(stderr, " %s", other_cmds.names[i]->name); fprintf(stderr, ".\n"); } - exit(1); + exit(EXIT_FAILURE); } CALLOC_ARRAY(ret, 1); @@ -824,7 +824,7 @@ static void abort_commit(struct commit_list *remoteheads, const char *err_msg) fprintf(stderr, _("Not committing merge; use 'git commit' to complete the merge.\n")); write_merge_state(remoteheads); - exit(1); + exit(EXIT_FAILURE); } static const char merge_editor_comment[] = From patchwork Mon Mar 21 22:54:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787872 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 400C1C433F5 for ; Mon, 21 Mar 2022 23:09:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232138AbiCUXLJ (ORCPT ); Mon, 21 Mar 2022 19:11:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234304AbiCUXJ0 (ORCPT ); Mon, 21 Mar 2022 19:09:26 -0400 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48DED2B1B5 for ; Mon, 21 Mar 2022 15:57:53 -0700 (PDT) Received: by mail-wr1-f43.google.com with SMTP id t11so22679266wrm.5 for ; Mon, 21 Mar 2022 15:57:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/GhEQD87gYxu1vWW6ojun3MPQgZxaF8ByZgXin9ujVw=; b=acURERipm91Vi/LVN0lkcEdXTcCPtniCbwthV3fm8RF+zuiS+mCCkvnZNqCJ2VF7lL boSt1mF//7932dPMlaxDnbZ46kDtxsyUbK/dK+LJHlr7TC3dZHFnIsvBmE5AI/6zi66r PLCuKcq7L2GL2eQyn/3/viZ8ErzwePIGtMuIRaxkb/tpgkvF17l6Nf2WwJMpBjbdrxCd 38vnHhm+i5CCsi9nu7vivisXRVMFQcSFRbF2wTnNlauuA8nKsnw7sExAuP0gYD1/mcWz zZeMdrv84CrgorVHW1yz8OI5sx3Ciu4vwdRRsT/3UOrEmqO63eTaopgKAvu5VWV+8vIj MvEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/GhEQD87gYxu1vWW6ojun3MPQgZxaF8ByZgXin9ujVw=; b=l6S4fJUPKvLmo9i3CoMbz7ur2vMzaHgT5p+37tHz6RWmSpbIs1MocTBHpLLT37Co+7 Ug3ghlZUgtsKyes7HSOIbV4wry58jmjARg2WpCV5G6xyNOXqqnwq1klc9xyn7rJq+6SS +Y22wFlySKWdoXXsp72A/5dCL0Zp7zrtCu7LdAN7zfEjYy4BTvs3nqCKUP0l4Ko6r+uo kiwQPTlWp290TJ0pyC7b5tJ+ULwHdBXZ8dhBqiyH9fUbm3BB2sPXqbUTtZJszEHShv3S aaxaWwCvxQ3GI/rJDY1Xkn9HkZCqJKYuDK48pDRPESDfmlMI5xzVURxrH4PsaeCgaRHX smzw== X-Gm-Message-State: AOAM530rozNxuxl+YR/D3iwQug4b8v96W6iLw5Snt3dL9AKLiWLeS12m 2j5v9XBZytc0t2rNbDrouK+7RV+tdcY= X-Google-Smtp-Source: ABdhPJw06VR7P9PFUCNo9bW3EOTm5/UoazpB/8yMsp8g0tWw+KDicVVjujsKMeRWKYMChLnewQZM9Q== X-Received: by 2002:adf:f70a:0:b0:1ee:33bf:3864 with SMTP id r10-20020adff70a000000b001ee33bf3864mr19383116wrp.4.1647903351839; Mon, 21 Mar 2022 15:55:51 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:51 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 12/41] pull.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:54:54 +0000 Message-Id: <20220321225523.724509-13-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/pull.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/pull.c b/builtin/pull.c index 4d667abc19..3b16e891ea 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -489,7 +489,7 @@ static void NORETURN die_no_merge_candidates(const char *repo, const char **refs fprintf_ln(stderr, _("Your configuration specifies to merge with the ref '%s'\n" "from the remote, but no such ref was fetched."), *curr_branch->merge_name); - exit(1); + exit(EXIT_FAILURE); } /** From patchwork Mon Mar 21 22:54:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787855 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4594C433F5 for ; Mon, 21 Mar 2022 23:06:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231896AbiCUXH2 (ORCPT ); Mon, 21 Mar 2022 19:07:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232118AbiCUXHS (ORCPT ); Mon, 21 Mar 2022 19:07:18 -0400 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 010F02980F for ; Mon, 21 Mar 2022 15:57:41 -0700 (PDT) Received: by mail-wm1-f50.google.com with SMTP id o7-20020a05600c4fc700b0038c87edc21eso687221wmq.0 for ; Mon, 21 Mar 2022 15:57:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=syJWHGONhgbM/mz6hF20nLA370dSxhysyv3V9DRQUVQ=; b=mj+muPUtmz40g1CCdng5g29P0gaJmRo0we2dlHgGUsNHnBurGPoTl6qyX+zRqrUIaK MdvFKChLWmQhxoCb558aa75ar0xPk+5yehJPXdmWMG9XMYkq4wRMwxs630HYDZqbc2+d 1JaJDGw5eNbCdCB7XgoNFVdHkbIIuZjGXfmr8yQvGhmd6qd9bhGWQrzOlMJWp6p0FaGM YUwDyzoloTFIR7sZPKQG5s1HbnLC6o8sYmElcb9KmoyGVRuSjMI/dC5JbGRDXkKcaTFT LI9ugjnYa0nw6u0yG64wo3bY/84/QpM2A5ENCHvECOsrtoHlOZiN8TGwVnidspTWHLEb 6LIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=syJWHGONhgbM/mz6hF20nLA370dSxhysyv3V9DRQUVQ=; b=u3kp7iWKmro3mQSjF44alPKlAeBe96gJNMg8Y7UEUdhH06FIo2htcwUcSnIOu5J8at 3n49tlTvLZBHS6lCoIKev+hCvGvjSYes34o5FqXHx/AEuXlWwrLqHSTTuoDpOpJLrWb+ ANl5CBz+FVj01RGYcgZgtqq+smkMEqwvZfjwjQU6W/hF4XdMceDWIgEi9pD1QDXHwfFj MxWbYT9bQMEDMZiYrznx1Yv3yGc5HZHrCTYzqxD1bNPwFm1OCjYBGcQ738QFdaKbATqj zxtlg9CcR6lmUFNrXV6r/dp1zgNixGkjPACvA2xrN+qlFcanyz+9nUdK6P6DuuqC3MXw t4Zw== X-Gm-Message-State: AOAM531kwRc4gEFzSzd+JSHpnbSCDCQvbikAw5gXQgJ/8qKhDzPFl8cS QvXBxcLQL1/LpBSecq3YXhxuyg4M/6c= X-Google-Smtp-Source: ABdhPJxAyaYj1HpSWaTte7pWV/aCFFT1LTtKeddQC8Fd1dlhWGpeKF9kgRPR82R83jXmYEfH+BlI8Q== X-Received: by 2002:a7b:ce83:0:b0:37b:f1f1:3a0c with SMTP id q3-20020a7bce83000000b0037bf1f13a0cmr1132132wmj.10.1647903352660; Mon, 21 Mar 2022 15:55:52 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:52 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 13/41] rebase.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:54:55 +0000 Message-Id: <20220321225523.724509-14-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/rebase.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/builtin/rebase.c b/builtin/rebase.c index b29ad2b65e..cafacc87f8 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -988,7 +988,7 @@ static void NORETURN error_on_missing_default_upstream(void) "\n"), remote, current_branch->name); } - exit(1); + exit(EXIT_FAILURE); } static void set_reflog_action(struct rebase_options *options) @@ -1266,10 +1266,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) if (has_unstaged_changes(the_repository, 1)) { puts(_("You must edit all merge conflicts and then\n" "mark them as resolved using git add")); - exit(1); + exit(EXIT_FAILURE); } if (read_basic_state(&options)) - exit(1); + exit(EXIT_FAILURE); goto run_rebase; } case ACTION_SKIP: { @@ -1285,7 +1285,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) die(_("could not discard worktree changes")); remove_branch_state(the_repository, 0); if (read_basic_state(&options)) - exit(1); + exit(EXIT_FAILURE); goto run_rebase; } case ACTION_ABORT: { @@ -1297,7 +1297,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) string_list_clear(&merge_rr, 1); if (read_basic_state(&options)) - exit(1); + exit(EXIT_FAILURE); ropts.oid = &options.orig_head; ropts.branch = options.head_name; ropts.flags = RESET_HEAD_HARD; @@ -1388,7 +1388,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) for (i = 0; i < exec.nr; i++) if (check_exec_cmd(exec.items[i].string)) - exit(1); + exit(EXIT_FAILURE); if (!(options.flags & REBASE_NO_QUIET)) strvec_push(&options.git_am_opts, "-q"); From patchwork Mon Mar 21 22:54:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787887 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E487C433F5 for ; Mon, 21 Mar 2022 23:10:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232218AbiCUXLm (ORCPT ); Mon, 21 Mar 2022 19:11:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233748AbiCUXI6 (ORCPT ); Mon, 21 Mar 2022 19:08:58 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D7A84BFD9 for ; Mon, 21 Mar 2022 15:57:13 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id h23so22039915wrb.8 for ; Mon, 21 Mar 2022 15:57:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nAdC0fg3NmY/18s0r0twLr8SfiD39z61/dO+DQnlen4=; b=TAq+jZM7MyUaZlQFniqCuatRao3R1jM5z+YqBfwmWcclwRwWG73EAQZWrHJG0uIB8K Y95hFkdaOdLrlA/EO6utiKm749UmYjWUTK7ROv3GvoAiIkvw96Y+MqYU5p2a8m5F5GmE X5Nokm4kFZkED0bSHZTwUmuO+anC1rpW9ppeDYa5Tr0y67T1Tz2JvID27YY5odRGR9Al hQtK7DM7OUzrTY95cZcgY91CipH6bPUWYMbzKav/S/2nvnp3WIJTFmnU8UsX0paOVCg+ tIb42MWWP1DkV9Sm79kZ4STPnsSwwmqr6g6+DQqO6QTSUrqOikpnsMI1pJ7o3f5+QWeR TMhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nAdC0fg3NmY/18s0r0twLr8SfiD39z61/dO+DQnlen4=; b=Ed+4DPtq+4/ivUABHMQ2AT6LNrmD3OJQB1ubBvGNWacNyLKIoqa2UIPRdKEDPcQPeZ ZWyUjV76xnK9rLafxFsLB4RxXgZtw+efus+suoMcVp+i0xLxZHyFGogY1NoUaPei6wED uB/knp9JHnOOD4FRxPXry9t2R+Y/M7q1ZCW4AqefM7zbCH9OgwRsFRMzohqZdu+/IbbQ cbSxXikD8YxAihygZddJvv9HIL8kzCePP3Fbeq29tLKAfbEC4oQSofkqZzuF0ivd4vo1 +xMZe143BbNpEwPHd/MG2rLxemm6pKfw0w4CF5xmRsxpZz6NXuuysw0BEZU+oy8w1mHl DhHQ== X-Gm-Message-State: AOAM530HS80qmFM7Est9kDuf3wSwqPGK0qWykm/VTF0+CAcRPyIV8TPt hFTVUxz3aRKk39cRO7oZ6bPwXhvlLfc= X-Google-Smtp-Source: ABdhPJwF+QM/CM3uUR/RYXYFTWF/C5iMRjj/hKCCMkzNNXMIPa2fAZb4kbCXGeX5xj7v7VHNzeY40Q== X-Received: by 2002:adf:e18f:0:b0:204:444:dd0d with SMTP id az15-20020adfe18f000000b002040444dd0dmr9574914wrb.678.1647903353627; Mon, 21 Mar 2022 15:55:53 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:53 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 14/41] remote-ext.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:54:56 +0000 Message-Id: <20220321225523.724509-15-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/remote-ext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/remote-ext.c b/builtin/remote-ext.c index fd3538d4f0..3b32d68ed5 100644 --- a/builtin/remote-ext.c +++ b/builtin/remote-ext.c @@ -172,7 +172,7 @@ static int command_loop(const char *child) if (!fgets(buffer, MAXCOMMAND - 1, stdin)) { if (ferror(stdin)) die("Command input error"); - exit(0); + exit(EXIT_SUCCESS); } /* Strip end of line characters. */ i = strlen(buffer); From patchwork Mon Mar 21 22:54:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787879 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 610FFC433EF for ; Mon, 21 Mar 2022 23:09:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232391AbiCUXLX (ORCPT ); Mon, 21 Mar 2022 19:11:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233581AbiCUXIs (ORCPT ); Mon, 21 Mar 2022 19:08:48 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A188506FE for ; Mon, 21 Mar 2022 15:57:18 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id bi13-20020a05600c3d8d00b0038c2c33d8f3so413117wmb.4 for ; Mon, 21 Mar 2022 15:57:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kF+7rkf/S8GPsJaCqzMCFIaOe6etW4B3vxUir+eGeRw=; b=nhEcfyqjLOMq6/55xpHv1M9OxMbPPSHyZneEDxi0Hjc2j4AaF6Dzj+GeJSR88g5wyW Vm7/ev7K2zAkEgKXJ07/X6u0CLq+dWDJVr38ZYykjDgESmXayJmQ4ewjYyxDsM8AZA2b eu6YtrbfF7+rE/r6WWUWc0LAzZOb4sYnksSRnSoHeifkk7UwW8TH4FprP2mcn6X+ei+f f3WczhiGxwIWfy/6PzME94VR4aVm6SblBfNBhXS3px0tk376U5O+iXKX4Mc1Eb2KhW22 R3qzlceL4Z7hhYvA/6t0WSX8+ZNDBiBIzt2LzUAePhhqvoKK9ibyR3fF8v06b1coYnEO ew7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kF+7rkf/S8GPsJaCqzMCFIaOe6etW4B3vxUir+eGeRw=; b=mnB/YpBbbP3qxc4zbPAVZIpMuNJPC94sc4KRy3vqetk87XpoNfCiy+17jlDbPp2Xi/ yabduOeJa07+CfpqAsWVFNcvL88EcheLg/HgUWpzm4/aWQ8ozEcchF+96pTI2GzgB9A4 af7w0r0ncWaHtP/MLgYwMJC2x2V7kkKLKU5rtAe6QaV2PGWNUSQsXvvoW0D39HJ3EbMr H/GDnbcPnYJVO71ppT3RP3tQ832AqABMhkc4sCunzCgfcqF3YARdxLycJjyn5OWM2M2V inEG9vpQBxp0HQi9vniC7JNxK4gTkLVSgVM7YybiC/BeB3S98OSa+y12QaAioDhkCw9K 9IAw== X-Gm-Message-State: AOAM531kFHDOneg1QtwhUzZ24xemIb2tDMIFqQVeT4ZTHdWDgcaEGm0O jxbceFnNQ2naHnNUUZlmumix1OF1rJQ= X-Google-Smtp-Source: ABdhPJyb171/Og6zZXcDU9u8wcT60+wmVEhtOrnGSMGQDy1ye1OpTA5r3DRU8Yhdho2xA6cEKZ908A== X-Received: by 2002:a1c:7312:0:b0:38c:6f75:ab28 with SMTP id d18-20020a1c7312000000b0038c6f75ab28mr1132469wmb.19.1647903354476; Mon, 21 Mar 2022 15:55:54 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:54 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 15/41] rev-parse.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:54:57 +0000 Message-Id: <20220321225523.724509-16-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/rev-parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index 8480a59f57..e313b64fcd 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -543,7 +543,7 @@ static int cmd_sq_quote(int argc, const char **argv) static void die_no_single_rev(int quiet) { if (quiet) - exit(1); + exit(EXIT_FAILURE); else die(_("Needed a single revision")); } From patchwork Mon Mar 21 22:54:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787875 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8BCAC433FE for ; Mon, 21 Mar 2022 23:09:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232246AbiCUXLO (ORCPT ); Mon, 21 Mar 2022 19:11:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233559AbiCUXIr (ORCPT ); Mon, 21 Mar 2022 19:08:47 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7993F39CEA0 for ; Mon, 21 Mar 2022 15:57:17 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id a1so21280106wrh.10 for ; Mon, 21 Mar 2022 15:57:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wnFuVnVjTWHB7jECLJVH1BpGSkn/m49hn/B0SfIihgk=; b=Zk3gsnqbQnwn+f5jFNwzOT93LJUoIcx41Df66CiUxAQ7A1Ho6BL4Xewc+gvYPZcVTn pU7atPn+r+N8lI4wS6MSmaK0QPiXT6zVLPg1GbvESDaDou2kQFXyCAWChFMrRsLebyOw hoIDWuOZcSQ2yIosh8HXY5Ydq5B4xQmQFZMHgK3xuBfzBb6YaQRQjgmSr0KXfPcntjwA cjSxkZSHBPduYa+qZ55JwtVx2GCPXBYfzAf9eKRG4JuILgcIbbWVOuBpwOdQphq2N8eS JCetDUpQ0JVsoUdeRQE+admGtucxGe4Td7LlMT1p1khc9125eB9wuuKo2BKaWLA7lqaR uEgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wnFuVnVjTWHB7jECLJVH1BpGSkn/m49hn/B0SfIihgk=; b=qyhfBLa4vCBC2olmi+h2wJRV47+iyZ2CT+lkFiZt9j0jNov8uvIms6Bgbq/RrXt73q +LogLOFrVaTOEvgVsAKKugGwkSIqxlRi27B6189DFW8Uovl4zyVfyqlPYfZC1zvioM9m +NSW5hcU4s5MI88wVZJCKyDioWTl8bCYeQ0ahb58SMHv4dc/hWMfOvkdZjjWPVvUZHPB uTnH42N9lY2eR2LJj1m1TJ3ahle5LfhLgkALtLuHjedKND0M5FjX6DZvG5h0NH3qOip4 2050YoWvSZfaCYrfpTfC/RaSmjkCw6tTwrZDWNk/ufsM+3YZYTxv/EnF/F+Z6QzG1gkx 5onA== X-Gm-Message-State: AOAM531yS4LaUQMWhAPu+SZSXc28U6LMcn6c9pyN/ibp0FLy8qwtALyh Tc4HzrJpG73ReFVce0PH41+XDVwgHnI= X-Google-Smtp-Source: ABdhPJw5miK/mooTgBZ0u6CzMSBgCzLETUlP8XDJfMoHjd5HEVjp0dalepls/lXDdO9MaD4mzPZdHg== X-Received: by 2002:a5d:4892:0:b0:1ed:beaa:778a with SMTP id g18-20020a5d4892000000b001edbeaa778amr20000639wrq.35.1647903355307; Mon, 21 Mar 2022 15:55:55 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:54 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 16/41] rm.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:54:58 +0000 Message-Id: <20220321225523.724509-17-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/rm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/rm.c b/builtin/rm.c index 84a935a16e..4c4546bad8 100644 --- a/builtin/rm.c +++ b/builtin/rm.c @@ -369,7 +369,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix) if (get_oid("HEAD", &oid)) oidclr(&oid); if (check_local_mod(&oid, index_only)) - exit(1); + exit(EXIT_FAILURE); } /* From patchwork Mon Mar 21 22:54:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787871 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4790C433EF for ; Mon, 21 Mar 2022 23:09:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232351AbiCUXLG (ORCPT ); Mon, 21 Mar 2022 19:11:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233784AbiCUXJA (ORCPT ); Mon, 21 Mar 2022 19:09:00 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E91C3B5021 for ; Mon, 21 Mar 2022 15:57:15 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id r190-20020a1c2bc7000000b0038a1013241dso374070wmr.1 for ; Mon, 21 Mar 2022 15:57:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=74Y/pQydY/ksADNHRzSGGxn3AcdvAHVNEsdGZUW+1tk=; b=kIdvIsuxim+LYLabEfC1cI2FYZTOHSxgBZGovey5XJgdBba875rTprqrDJGgXeQlu7 AZoebQUw3JeEf9COnsaHXlfxenTn81Fm7XYLosiVv6GBjC0yzZchETZKxMB5casY0yM5 htWcVM9g+LynyIGkzCe5hs0of6xpFVyT4F0RCmQNivlKZc51qH9jGSBC/xyp4IzufOgM u/zcIjuggRF7rcOwWFdhnanEF209fkv0c2t3JXu9H0I7OQE4/wIJmVxQKAd6dQbm5iH3 DtrJVrMa9JOdEyDGFEamBpHfrpFjIhFBX/1F/5xe+nXBIPwkw0jbUwDxjojeirLzppfz wfpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=74Y/pQydY/ksADNHRzSGGxn3AcdvAHVNEsdGZUW+1tk=; b=r5CdvDB7wNH1YtgnRn4mFdIqJKFqXlheu8C8D5kChZoGucDGeF184ex3SCYTMgTqiD sEEPDd7p31uGZ0RAEXvRIeklmouhDBlHHhbZ/nx660epRzFmMaiKOTe0+od8tSVF+8gb bkLZBAJooj4ETrBOaSRYrvssupkXSxFJkqIvmCX70/r0lAI3kE5v5r7zY8Xu/ihjy8H6 7y13D1YwXYTb4O8dCaJeJmu6paI1du7Ay1xdRKKslozZQXNdI6ZU5OAUSyBaE/JxOdDO w3VNc6xrXyKT067AJ+vSw6Y5kl4OCwUQ+ixUQbnm5w+y1pK5hcBIs+sd5Q1sjXFFq1Pt Ja+A== X-Gm-Message-State: AOAM532TGEpkD5Taf+LeNVQEqxHTSa4N5df0yyiut0eT3lvbnysTlKfb I4ZcPp05Ca/lGc/85whVOYmtyx6sEjs= X-Google-Smtp-Source: ABdhPJzaACq0aVazyh5KJ2PU8/+wd3KZ3wMnNHwkjfaRPNgUf5/L3vSoOhMhKWeJ1bK94TWyed1Ogg== X-Received: by 2002:a1c:f604:0:b0:38c:8ffd:dbb6 with SMTP id w4-20020a1cf604000000b0038c8ffddbb6mr1095358wmc.43.1647903356230; Mon, 21 Mar 2022 15:55:56 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:55 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 17/41] shortlog.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:54:59 +0000 Message-Id: <20220321225523.724509-18-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/shortlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/shortlog.c b/builtin/shortlog.c index 26c5c0cf93..0763c94df6 100644 --- a/builtin/shortlog.c +++ b/builtin/shortlog.c @@ -381,7 +381,7 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix) case PARSE_OPT_ERROR: exit(129); case PARSE_OPT_COMPLETE: - exit(0); + exit(EXIT_SUCCESS); case PARSE_OPT_DONE: goto parse_done; } From patchwork Mon Mar 21 22:55:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787881 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E067C433EF for ; Mon, 21 Mar 2022 23:10:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232403AbiCUXL2 (ORCPT ); Mon, 21 Mar 2022 19:11:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233648AbiCUXIv (ORCPT ); Mon, 21 Mar 2022 19:08:51 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 724C850075 for ; Mon, 21 Mar 2022 15:57:15 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id r10so22689786wrp.3 for ; Mon, 21 Mar 2022 15:57:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vjS1e+sxxdbN387S/B19fro7YDW3v+cHmLxecGDRcjs=; b=CVOTONMipcgySQEYCwnZ8OxY8uKSq2oz9GbK5JObYFHvqEoSw07DvT8lWe195WYxCy 3He3cWRKxnIc3kfaDt7XYGyQhDI8wW4WgCOMzcpvqsEp9y9P9f+bWi+6vSORZrFzVASx GOhuu9oTSy7f8jXfW3+XRKi1RTEx3DJvHmhmz5NwsLy6LnpXMJjR8v0XmeQWNo0P6EJV XC+4Q4/qRv7OtUAFNmpB9fh+rqw8u4qsxIU4y0n0iZJr9z1MvaI1Lm9iHZYn4d2fp/qD uhGDJFITFlz5pluMSS804J+/3vjyak3nPtr+ZjavMpTkPoKwNEjY4kVxZw8TD1N+OUei OQ2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vjS1e+sxxdbN387S/B19fro7YDW3v+cHmLxecGDRcjs=; b=rmV5ZxMuD88VL8K8cLKu3GyBnx6nJSGtGTZAWN5GspiXWoDDXiQIXjnM016tzBf3dj RJ2a3nX3/2w519aKSklxwIrjes7K+IW+fOYYigqx8dXKA0T3+fwD3YJaxmaRpw7IjYRj TaQFMvSTgnsu67kGV4+/ohiSSCzxzAXiBG5V0NuUIjNT2flNBdSp9GlygG+/nGT88XbB j3erNT+5Iia2f5WDPGez9bbHn2i7hK4JFheYzulUIIzm3XPOs5xinOQD90z/3njhhRZ6 sO1xoPdrf1NY8f6AmdvkZowhRDrIwJjywfTrm1AwmyshA2HgNi/JwudU0KRA1XM9Nhs7 W2wg== X-Gm-Message-State: AOAM531ak/jw5Sm0MNVFuV2CL49YuGUxl/Ir4PtW1ltypktc2ZBszrer 0Jj56hfdfhKXDjr0qJ4Zn0TLQuQLTRk= X-Google-Smtp-Source: ABdhPJxHY7r9VQyDOdqPktqrXgskjnrcPBQVKH7VRluMtGPIxRVPrspkE38uVBPN5WZFd/0iP/ElZA== X-Received: by 2002:a5d:5509:0:b0:204:f77:c2d with SMTP id b9-20020a5d5509000000b002040f770c2dmr6417226wrv.432.1647903357121; Mon, 21 Mar 2022 15:55:57 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:56 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 18/41] show-branch.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:00 +0000 Message-Id: <20220321225523.724509-19-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/show-branch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/show-branch.c b/builtin/show-branch.c index 330b0553b9..04a99aa7b2 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -820,7 +820,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) if (!ref_name_cnt) { fprintf(stderr, "No revs to be shown.\n"); - exit(0); + exit(EXIT_SUCCESS); } for (num_rev = 0; ref_name[num_rev]; num_rev++) { @@ -898,7 +898,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) } } if (extra < 0) - exit(0); + exit(EXIT_SUCCESS); /* Sort topologically */ sort_in_topological_order(&seen, sort_order); From patchwork Mon Mar 21 22:55:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787896 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25E95C433F5 for ; Mon, 21 Mar 2022 23:17:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230318AbiCUXTH (ORCPT ); Mon, 21 Mar 2022 19:19:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232488AbiCUXTB (ORCPT ); Mon, 21 Mar 2022 19:19:01 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D01A2A12B8 for ; Mon, 21 Mar 2022 16:08:14 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id r64so9409933wmr.4 for ; Mon, 21 Mar 2022 16:08:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=N7OIzuAD4d82PuujQmbOZ41TnMl4AcEADQ2IsmOons8=; b=p9g5qbYtwt6+wGqVBT6hckKp/tr/MOcctFhuvlqq4/SryrM79Wt/EEyOr347S1Z95R KsEzaI2Pfx1T+kPbftlIz73BGWCftP/q55AWdC2jJFU/cRBKPV0ORj45WFutfH3ZW8/W P6qmNXGczeSdCY8wx4I9m2mSFQoa1/QvI8NGO4XATZSkYSihN0Wmz/ucJSXwuYHJN4a0 TEz6z6KkJxEImSs/M3DdgodMoZl10zXhbEDDgj5GWZ8U+T6kP+6bXSASsk7sq53OG5MW iNTPKS/aC5dCbbxF5mRqBlLSth4w3MOiLRuaTLTaOE/cITfgUJ/OclsR9fSEvSTOU2Ty AmsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=N7OIzuAD4d82PuujQmbOZ41TnMl4AcEADQ2IsmOons8=; b=iNxGq8RjXrvexSyrp4xcYGkb/fu38Vp8bkNs8bIsupLmXSyBoE06ab5UEFMcrRiktT r0uSpV2DeWXkOCMiuxfDf2fB8QWnI8IJay4a+1qd5tB8+0PNdLh+idCrW5Ja+/psw0Nu jTzVAAitt62MGBp6r9uoEkwOlygqTw3r3Un1a7Xbvsyq/lTMBhDwXrpftR5nRxpa+TMM 9fyq1CylO6DwDhrVK4Q0Qp1WnD4XZf0BjMAVAaS0gKR0qWwiwTcedLdFDzhB1AX8PB8v tHXIi6lXWf7eG8B9HbQlSY2zan2da8XEPajqcVcQgLfwknS/zt24CGkq+g9z05OwfR4r PbjQ== X-Gm-Message-State: AOAM530A8j8CNHPZZTYcFwZFh1hRQhrPlBc4WBmeRHH+unx6bi90+caH nDKyfSDt3XNCj/9ZI9Zz2WHpdUcGENQ= X-Google-Smtp-Source: ABdhPJxBzOj56bYvjGyaBql1m0CXXCiCZH8OxDwcQWqEwcuGO9ADXeI88Cp2u7gfz9maIJw+rtXdRg== X-Received: by 2002:a05:600c:1c1e:b0:38c:b393:b355 with SMTP id j30-20020a05600c1c1e00b0038cb393b355mr1119544wms.92.1647903358026; Mon, 21 Mar 2022 15:55:58 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:57 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 19/41] stash.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:01 +0000 Message-Id: <20220321225523.724509-20-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/stash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/stash.c b/builtin/stash.c index 0c7b6a9588..9315ff74ce 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -656,7 +656,7 @@ static void assert_stash_ref(struct stash_info *info) if (!info->is_stash_ref) { error(_("'%s' is not a stash reference"), info->revision.buf); free_stash_info(info); - exit(1); + exit(EXIT_FAILURE); } } From patchwork Mon Mar 21 22:55:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787867 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0C40C433F5 for ; Mon, 21 Mar 2022 23:09:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231996AbiCUXKs (ORCPT ); Mon, 21 Mar 2022 19:10:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233375AbiCUXIj (ORCPT ); Mon, 21 Mar 2022 19:08:39 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BC9D53725 for ; Mon, 21 Mar 2022 15:57:26 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id u16so21647934wru.4 for ; Mon, 21 Mar 2022 15:57:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V6Fu5zoAqStBiNrOiH0t0MHXRWI/vlh3/Yf2Z58fgIE=; b=XVzLzgJNsnM32JzBiLABDNCZM9dWUMngSe0haXl3Q7NFT29yzekb/xLgRvuVHVsVVd Hip4fDj8ZRloR7ghxfFfRLEgU6Arq1yvD22ggyvc924OGkHp9Y/Elf5xZPjqWJZpppyF U/eYB2fGA0ceiAHFH3JnEsNrODkc6uJot5g3Z5aAdSy0rm5irvvAv8+IlzOQdYFxi0XV 0XJdmHnB3jWz0h95tcpFr/8eGlZT307u1AKo0FfdLeCPF7Y8hmhb3S6qm7O6mQBuq6Wp qXUv/vNADjHtMQrYcoYf+Cirb3Nbfnmt6qeTHgmDZM0VXKkaKmbZbh3FIXM9qH5QVt2F 71wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V6Fu5zoAqStBiNrOiH0t0MHXRWI/vlh3/Yf2Z58fgIE=; b=lPDXQ+O682VIxDhuihVqHsdaX4ZMIrdXwUWXjgbCEvvwujcXRVHtaoSgR6+Cw0q6O9 6MJ4whDdNSQ7YijXm5Ojl6eVSTGx68kvxp9rrH6DR8aYliiq/iQPKoFtsRkiXoRWqEUf eIZX9GPucJxm+43X2B7WFRu+NsvKCDHeXTJkc1UEa50AfjK/9RjIakNIO7ZQKrNfpHwL VWlxeM3o1lU3s8qtRT31eY56OqhYSJ+CoIbXQqUyQF8G5gYU5F4UkmJOVUjgu4hwYJYJ 7Sm9J5IAXD354Zia909BhsRTo+5bLVIerUBCObL2m4dJP7+hRxVSXjZ7EmG49ihki442 /RfQ== X-Gm-Message-State: AOAM533JpfSRp79DGIsv7wd54QfCLdJ/GjnbYcpkWm/mlwHghTb9oKzs RyK1Q6SuZM6MH0YG6jBjp7l2JKkIrXY= X-Google-Smtp-Source: ABdhPJwLdvEUrwiAos+/k8Zo9MVrLMgAT9awX/j1PpvQMDpJPFGlC1g/Ri+O4L7wIh8A8GQserXiXw== X-Received: by 2002:a5d:43d2:0:b0:204:5f97:d003 with SMTP id v18-20020a5d43d2000000b002045f97d003mr797192wrr.417.1647903358863; Mon, 21 Mar 2022 15:55:58 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:58 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 20/41] tag.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:02 +0000 Message-Id: <20220321225523.724509-21-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/tag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/tag.c b/builtin/tag.c index e5a8f85693..55a808873c 100644 --- a/builtin/tag.c +++ b/builtin/tag.c @@ -315,7 +315,7 @@ static void create_tag(const struct object_id *object, const char *object_ref, if (launch_editor(path, buf, NULL)) { fprintf(stderr, _("Please supply the message using either -m or -F option.\n")); - exit(1); + exit(EXIT_FAILURE); } } From patchwork Mon Mar 21 22:55:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787894 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2992FC433EF for ; Mon, 21 Mar 2022 23:17:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232457AbiCUXSt (ORCPT ); Mon, 21 Mar 2022 19:18:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232834AbiCUXSH (ORCPT ); Mon, 21 Mar 2022 19:18:07 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BB5637BE5 for ; Mon, 21 Mar 2022 16:07:11 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id h23so22064971wrb.8 for ; Mon, 21 Mar 2022 16:07:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GxNPTjgQHWTwR4HeroEcCjNYl9gHKMxMRyU9DkdOhD4=; b=PAwrvYgkLop/xJMr2nAKAs1/sGFQNwt5cRU+080aX15I9axRgpbRzkyqR2KPdQ0pM7 9m/uNR61PHLGBs66lZn6IZBFon+6Ii2hIwvnk2JHJA4zIy0tsev1/fLjbmMdPW03mR3V a1viuFcaHOuK9L7O76AVsP/Gwgo/DUmJEW8yn9UCOZLUwLmtpmeglsmnAo4+3sUim+SZ oKJhJiQWFpWdri3K8/9UMsaIqtXppz2rCwAwH29k+5C0cd49TL45gYMkvVw0raX4/IbW 6IRx8pOR31xvKBS1DjpJH+LqGTX4sGLNB07GtpF8xUbqCBZEsn4+NloFD64K9pgBmsLf 4KQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GxNPTjgQHWTwR4HeroEcCjNYl9gHKMxMRyU9DkdOhD4=; b=P7zXQHcF5b0sAdb2clBowbHbsgGqbPJNfH7E5DHFIaQ4MWELjdLgx7iCeC7EN7N2HF X4rOaa7IsSU1zCA25IZrYTfz0D30wej9znWHdPmbu0bvWyad3m8i0ulFKsID4jC6QIl6 KhI1rcqURy633aI3Yhkf76jOrwNlYvsK+erdLGGeLpJl3kf0qYslWSFTp+Bf6/myGzLn +WwBigHLEdml6Ny+MryDRZ9XKFh7XCQlQidFAQxSw774Pf5xr8h3U5f8h4UkcN+DO9VS W2QZPg5ooBBVjhNKAoIQb14uLXZcikfFWYAVqwJYQraSlQY1rJPHotn+KMsM0UfNuxT7 +2ag== X-Gm-Message-State: AOAM5311+RVoyxnrR2Ocq3A/8+c6eySE9+bq+69paOtOpclX/xWVWzNG RB7O8qzTR+w7grTjhX/pYXxPIfvXD6E= X-Google-Smtp-Source: ABdhPJzq2DMd0ElDKwyvNSb3iYQ35SuDAk4SUOxYSRLM1Fw7Cp5RHBnecVFgXlIQ0Vj5PGRJLcvscg== X-Received: by 2002:adf:e74a:0:b0:1f0:25cb:3ad5 with SMTP id c10-20020adfe74a000000b001f025cb3ad5mr19773505wrn.231.1647903360589; Mon, 21 Mar 2022 15:56:00 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.55.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:59 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 21/41] unpack-objects.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:03 +0000 Message-Id: <20220321225523.724509-22-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/unpack-objects.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c index dbeb0680a5..d5838bfad1 100644 --- a/builtin/unpack-objects.c +++ b/builtin/unpack-objects.c @@ -118,7 +118,7 @@ static void *get_data(unsigned long size) error("inflate returned %d", ret); FREE_AND_NULL(buf); if (!recover) - exit(1); + exit(EXIT_FAILURE); has_errors = 1; break; } @@ -435,7 +435,7 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size, error("failed to read delta-pack base object %s", oid_to_hex(&base_oid)); if (!recover) - exit(1); + exit(EXIT_FAILURE); has_errors = 1; return; } @@ -482,7 +482,7 @@ static void unpack_one(unsigned nr) has_errors = 1; if (recover) return; - exit(1); + exit(EXIT_FAILURE); } } From patchwork Mon Mar 21 22:55:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787891 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D5C6C433F5 for ; Mon, 21 Mar 2022 23:15:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232526AbiCUXQq (ORCPT ); Mon, 21 Mar 2022 19:16:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232468AbiCUXQc (ORCPT ); Mon, 21 Mar 2022 19:16:32 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C5323719F0 for ; Mon, 21 Mar 2022 16:04:48 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id d5so7821334lfj.9 for ; Mon, 21 Mar 2022 16:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tOcKjz25Y+fbdMLra+nDprUOp7Xl7waEanzQpnRkU8A=; b=lNeo96+ToX3+ZW7w+26NE2kfudbmnnoL+HupHj7dBasQ/YWzWciuIuIWzA4nDvePkA 9RrFde6j0CQnaS9CIQC0Bu70ZlnVR8zcOX42qwHM6L+iAqJkjC50jwuX/b2MB8XnoizB lnUekJCVqBn4i49dn3TyTPkLWFD2MnM3G6Vo7O35H+eD6Qs0eD9Bh9g3ihMYUVASUO1G JqAxwH7q45nyASNyEgfseWU35njite8wCus8fAwLNse7VZKGUDbLDn9vcFdEjd0Y9nV4 regxxF8roZ894LmhYdy3fgzocAgzSEOGEwI7fzCpQUPJO9wkdZiC4jGXOsRA6/nmUGJx 7CEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tOcKjz25Y+fbdMLra+nDprUOp7Xl7waEanzQpnRkU8A=; b=zqL+fNfIVbA1GiDMnAW6zO0n92rT92w+UcRI/oP/8Qqvs8ahIj/oKd0GVlGUAwpIdn 34tawHZn0TvF3Oc9S2LtWCIIClpQxRJGK3a7VsaeK7sVjIKPwmQp0ysDiOKSm3NDZ4ZY KL0y/fI+919J4sS5609HkOCamVXadjEFJWL2PPC1Hu9zQ1G32luTVrjvtKsF6NUpxWPp a8tVC+CP+QgCbkHLfADRVY1uZa++3lJQZYwTbHwf+31UPSY9bTXGR1xcTFCVBlJadaoq ECWM2JzumRV7WA8UxCn4WWeOJy23iAtbRU60d7QFYyX1ttDSF7J13hY8+cUPE6HKatgf gxZw== X-Gm-Message-State: AOAM532JRc/s5R6DXdE9jFXoXTTh9fVmsKQxdkt16esQMQmNWD080H9w zEOVqqLix6HDis8QPYYsaJh4D+JmjR0= X-Google-Smtp-Source: ABdhPJzQJjUmAZEATXfrgvt0vvZLMlPgCQSG+LaBZ/V8iZFbNt0LQeP9iZJR95E5uhGKTmsvRjG8Eg== X-Received: by 2002:a05:6000:1ac7:b0:1f1:f9ee:7c57 with SMTP id i7-20020a0560001ac700b001f1f9ee7c57mr19325840wry.52.1647903361519; Mon, 21 Mar 2022 15:56:01 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:01 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 22/41] update-index.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:04 +0000 Message-Id: <20220321225523.724509-23-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- builtin/update-index.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/update-index.c b/builtin/update-index.c index aafe7eeac2..9e4c15e846 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -699,7 +699,7 @@ static void read_head_pointers(void) die("No HEAD -- no initial commit yet?"); if (read_ref("MERGE_HEAD", &merge_head_oid)) { fprintf(stderr, "Not in the middle of a merge.\n"); - exit(0); + exit(EXIT_SUCCESS); } } @@ -1127,7 +1127,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) case PARSE_OPT_ERROR: exit(129); case PARSE_OPT_COMPLETE: - exit(0); + exit(EXIT_SUCCESS); case PARSE_OPT_NON_OPTION: case PARSE_OPT_DONE: { From patchwork Mon Mar 21 22:55:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787893 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BB60C433F5 for ; Mon, 21 Mar 2022 23:15:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232270AbiCUXRR (ORCPT ); Mon, 21 Mar 2022 19:17:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232009AbiCUXRI (ORCPT ); Mon, 21 Mar 2022 19:17:08 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89EA03A147E for ; Mon, 21 Mar 2022 16:05:18 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id h7so9549965lfl.2 for ; Mon, 21 Mar 2022 16:05:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=++9Mr/az46tAJ1JYgBP0tAtKLRT3b3iaweT67q26lGU=; b=UtnLro8SMWT/2YgI1CCbNywSZESfbXaZEu25XGKNzAJsrlSSYPF2Qcc0InsdXYykUJ A29qZjGwQuPhGsKwK1uQmdHs7SO32DL4nvA3MUz/EvUnL8wLMds0z5M+RgGJ1wTYk836 nxqznMt+PwDVKkE7Q00IQMp1/XQtP9+2ecaxnarwGawYzVY6MTDgyGiz4jGZMgk0bCqB T2F713R6EL3NmSyh8ty3zrz5L6WTTlk8NYtQOT6Dz0A7QFWTtMbyMBwO8xnxXQzuXP3i 2R13jlrBmbySeq+dGvFS+5PHp+UXqCsneNSKSlLHQwLgwngY9GDidnP1Mj5jRHxgmATi 39ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=++9Mr/az46tAJ1JYgBP0tAtKLRT3b3iaweT67q26lGU=; b=uY4PbWMITWmT6EEaYyiqxocwSOzHYuCHtDegS8hHI4gRkKQznaxyIWotOfgmsvrhPP +ZdRUeu5Ups3u9LenR2NdYOZSTa4FbmLtqz8ijUey7WbvapWg6O0P7yxkBzwYEKMWJyK pKtmHSrWH77jrY6W21G+vNbEAvYdh4XIDGiIBOC3MgyKLtOzLuKLDCZiLZj9q/UzNmO/ JEX30izdC00DZYg2eKHUXyirjfDZEpjhcf7GFbggbIWtRGSUHlqntX4n33VdA5q2uIMZ luKF7GLKZACKLyARNbta0+woh4Cqm/2cAf/COldWA1f0NMYNOOitLGjMm/d1fnedD8Xq 3LHw== X-Gm-Message-State: AOAM530ie+1T7CL+EE4ll11lC+zptvaeAtoGCWtpCyiM9FWK5PyIlQNF eKP8Syhe/41serCg542oj5RJFNp/HP0= X-Google-Smtp-Source: ABdhPJwG/PLif0MsEv05EhckPlaYzxMF+5srvX6Al8L4ZQBGdTtASHjYdfnRrA/uMYYVR/8l6sH+Dw== X-Received: by 2002:adf:d1cc:0:b0:203:e857:85b4 with SMTP id b12-20020adfd1cc000000b00203e85785b4mr18390723wrd.666.1647903362536; Mon, 21 Mar 2022 15:56:02 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:02 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 23/41] obstack.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:05 +0000 Message-Id: <20220321225523.724509-24-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- compat/obstack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/obstack.c b/compat/obstack.c index 27cd5c1ea1..e8641816f7 100644 --- a/compat/obstack.c +++ b/compat/obstack.c @@ -407,7 +407,7 @@ print_and_abort (void) # else fprintf (stderr, "%s\n", _("memory exhausted")); # endif - exit (1); + exit(EXIT_FAILURE); } #endif /* !ELIDE_CODE */ From patchwork Mon Mar 21 22:55:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787866 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B39CC433EF for ; Mon, 21 Mar 2022 23:09:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231760AbiCUXKp (ORCPT ); Mon, 21 Mar 2022 19:10:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234884AbiCUXJ7 (ORCPT ); Mon, 21 Mar 2022 19:09:59 -0400 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A63F36E831 for ; Mon, 21 Mar 2022 15:58:19 -0700 (PDT) Received: by mail-wm1-f43.google.com with SMTP id m26-20020a05600c3b1a00b0038c8b999f58so432747wms.1 for ; Mon, 21 Mar 2022 15:58:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=34jVkjkIbsYdHX1BGp85Hz0fS5XIuCU638HAbVldiBA=; b=SRo7iuw1VXpqK4FxE8/CKIBRDyAqza/8tyyqpHF6KOh6lNprVKP/mNGpp7rb/V092k lBiS0MN7bN4UV5CfKOV5P3zIKCTSzMCRyCzBjqUmM8wfKT3n+Mp6LW1bp+q1+OQAUxDc BPCtw7NpvjgB7Q607+yCsc+B8aAliFG1iedSwqt7xl1rB75QSpVPhcM8ZGa9uKemmg89 PxaOalZ4fAOpdXmPK+38clbh/X1jimQy52WAfTudCeeKmO2hPpRFsyUestzn+iNKJnYn kzP9N2NbsiNf7bLFgOQXzb/RsJUerQXY/mtiZQPxVnoTwNF+J3iNa4BoItPdG2cFRjM0 J9eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=34jVkjkIbsYdHX1BGp85Hz0fS5XIuCU638HAbVldiBA=; b=kvw+zGSk43ndLXRfppfWdrSPrbphSIWCu+xWRXCT9l0PBxTplxplLhbft8Z3pXrF/L 6BCY9qZKxwl19HmXig5MpTjnFFu2ciQbYMizXGj/Dy4umTDUzbohR77s6CZGjxaaxDRb LkBzKquCmb+J+EHUWfS+iUPJ1p38fAL272uzRZ5x+4YV0U0ir5zZSl+LOuW0xNcz1hUs L8csQOy7ECy52Dil0JbS54TcVa8HNm31KYhQsOXMPuThdTfQBOj1CVgaRyByzaa01kan oTv0lJg8OLbXSHHMmUstcfwAa6zXzAsouhHwSzV8nO1hX3QC2c8DhXXB/VRQW0zsKymw ANvg== X-Gm-Message-State: AOAM531dEWFkk+3zyOuvs9k+oweeR9s0hYYUR/Sg+9u5eIeXPmLk70rA 4IXE591L+cxiZCb2IK6a68nOothne8I= X-Google-Smtp-Source: ABdhPJwIYHzadlWxrWjHyrDlHbGJ4eSirJpw6gSfEsoFd+rLXqDcYPitbER36PYuvTM/lr0BWC+qUA== X-Received: by 2002:a05:600c:4f4f:b0:38c:a460:c82 with SMTP id m15-20020a05600c4f4f00b0038ca4600c82mr1159184wmq.53.1647903363480; Mon, 21 Mar 2022 15:56:03 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:03 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 24/41] git-credential-osxkeychain.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:06 +0000 Message-Id: <20220321225523.724509-25-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- contrib/credential/osxkeychain/git-credential-osxkeychain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/credential/osxkeychain/git-credential-osxkeychain.c b/contrib/credential/osxkeychain/git-credential-osxkeychain.c index 0b44a9b7cc..169cbff821 100644 --- a/contrib/credential/osxkeychain/git-credential-osxkeychain.c +++ b/contrib/credential/osxkeychain/git-credential-osxkeychain.c @@ -19,7 +19,7 @@ static void die(const char *err, ...) vsnprintf(msg, sizeof(msg), err, params); fprintf(stderr, "%s\n", msg); va_end(params); - exit(1); + exit(EXIT_FAILURE); } static void *xstrdup(const char *s1) @@ -143,7 +143,7 @@ static void read_credential(void) else if (!strcmp(v, "smtp")) protocol = kSecProtocolTypeSMTP; else /* we don't yet handle other protocols */ - exit(0); + exit(EXIT_SUCCESS); } else if (!strcmp(buf, "host")) { char *colon = strchr(v, ':'); From patchwork Mon Mar 21 22:55:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787890 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A799CC433F5 for ; Mon, 21 Mar 2022 23:15:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232374AbiCUXQ2 (ORCPT ); Mon, 21 Mar 2022 19:16:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232582AbiCUXQK (ORCPT ); Mon, 21 Mar 2022 19:16:10 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8BFF446A52 for ; Mon, 21 Mar 2022 16:04:40 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id dr20so32404044ejc.6 for ; Mon, 21 Mar 2022 16:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Yxo+3mJUbpGNHPh5RaLbis7sEtSHOcPz/daQdB0IjpE=; b=nx2K5Z1w2oyuoKsSWn3eu4csuPR/jX5ZGl0jp52v3pX3lT4U73hk1vs8aazbMS8G4C kS5TxOtptR68QU0U0Krg+MwIgW3UBBrAUq8oyNMBLgEspXOEKhHwnYW6ca1ki3Oo/lfQ jdWjnqgL96alJxyWkSdntm6I4ML8gA2CoXPxqsYaBCysYxM4Tbf8GDRcyMvud2z26nSD 7IjVoDQBWryFkfeaCWwaH7nuqGY2LQxDWZpnrphCLDEiLxK6aIzFFvC+/p3N3AY9xaBE T5LMFlnAdHy1wpqSaZB1RD6AU1/Cd1fFIbb2GjmlQyCrHRFotNQEHWkRFEwb+b/RJ/6A JIag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Yxo+3mJUbpGNHPh5RaLbis7sEtSHOcPz/daQdB0IjpE=; b=TeknjtXVcaozgBkQzBpyt3+DHWDLqCQeC4+XBW6qEWspVW9tvLHfd3kwYqdxXbPA7O MlS4TDU08j3sBAIAksdFBX4ZuO/4MnzoooX2jGxQTwcAPBpxq9AGHBFcqTLzmPbYR+Bx YJbYehlQHdkorH/GmVeZc0EAvlu03gtA5Gvnn8UesncQ6Aq3MP+rgLzvk6uJH27WKq35 n6Ef/vBweMhY7mWZADSyiaz2wnJt5lKNXMxBxMK0+OJS8v8l7zzrj/ELdGW5y4yz6lac YjgQTMOhaoVOKd7TFJEf0AkjVel3xFGFB+2CmBsqrtWyaV5BNGkHe8hFz2MrwLUdDmMQ zOiw== X-Gm-Message-State: AOAM533qzAi2EzJgDnxHvPtQLLbutPvGpYz/JTwHzkPsP7+GhqFqb5N+ dinS5RfPDmJXqqfeY0BQ42LM3opSKW4= X-Google-Smtp-Source: ABdhPJx4VAVBXaIWZKznWS6tKJP1lJp0jkzySvhYQaE8fGWlBy+MY6le4E5vqNdXh0WYoVzvT5htig== X-Received: by 2002:a5d:59a2:0:b0:204:20d9:a5b9 with SMTP id p2-20020a5d59a2000000b0020420d9a5b9mr871281wrr.560.1647903364291; Mon, 21 Mar 2022 15:56:04 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:03 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 25/41] git-credential-wincred.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:07 +0000 Message-Id: <20220321225523.724509-26-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- contrib/credential/wincred/git-credential-wincred.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/credential/wincred/git-credential-wincred.c b/contrib/credential/wincred/git-credential-wincred.c index 5091048f9c..25028cd39c 100644 --- a/contrib/credential/wincred/git-credential-wincred.c +++ b/contrib/credential/wincred/git-credential-wincred.c @@ -20,7 +20,7 @@ static void die(const char *err, ...) vsnprintf(msg, sizeof(msg), err, params); fprintf(stderr, "%s\n", msg); va_end(params); - exit(1); + exit(EXIT_FAILURE); } static void *xmalloc(size_t size) From patchwork Mon Mar 21 22:55:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787862 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07184C433F5 for ; Mon, 21 Mar 2022 23:09:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230320AbiCUXKh (ORCPT ); Mon, 21 Mar 2022 19:10:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233036AbiCUXIU (ORCPT ); Mon, 21 Mar 2022 19:08:20 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CB0E4BFC7 for ; Mon, 21 Mar 2022 15:57:29 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id n35so7791794wms.5 for ; Mon, 21 Mar 2022 15:57:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D6JK1ko3GgXmzBEKlacZFTwKT+j13QTKVT7Pq1rPnC8=; b=KEMcYVDFyQPaj5ceGGBFgUOstwYYJ5oC5ibeo9AxSyo4NJSkV0I3ViOMVx8bkCl4Ar Lv7CKiEf+fWuhtKH4MwsnjuDUEuNMbVMP46McCISoav0M6mzBny9gE/vt8rBE3Pwdrkb 44mgGmBTClMcGXMlZJiVAUpwK2B7ANNWr959cYhwFLM7vtrVQ193lb6H9gWVJrtpdFf/ aUanobeWHtPEP/rSbJ78aUsvANi3jqfCfNBtel7hdPsyA1dTq3CfWavq8S7G9t7tSIXJ BLt9MP60XTf9cvgQpoPJg0GW4xGDRFcm1KG1DkXyjpa9Af6q2yBxvD8l9UArjQkoRVUs owLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D6JK1ko3GgXmzBEKlacZFTwKT+j13QTKVT7Pq1rPnC8=; b=hPEOWZZ0RT5gEygp5CydqlS27Mh2vv8m/nTtNHNpdujS5AVRaTzGa8NNk/WLfADesC njP3VpoePrao8jYM3a51k8DYl+4K871oKVFlV7dfwKYeW4Pb37RtEQeH0awucsEXppYo TLnLUu4HZJDm1vKQPvCSn2BHZahPpnrhwvmk9IIi1FaKFrHfS4ZiZki5MxQSlT11HjaJ vISEcWlkBHL6641dfHSDfLADQqyg4aDwUIqNxDPu0MuA/m+XjlCnC+XxjBEct70ZjU+l WkgJxk6UhLnPLAZtPOzcBDxrV4Iki1wGrQcU7DAiwq8HhdSsJedDeLFtvgVURC68zlqq Sbdg== X-Gm-Message-State: AOAM530HJ/SNLGz+pn98zEe4KtmymmfVJMxE/g/9F3hK5LVPkRCiLbPS StxrD6qUMRAZjoiK2fjjv2fsBWs1h5s= X-Google-Smtp-Source: ABdhPJwfgzGpMZHNiTS2QXeY07IZp/KJ9I/W2l4oLlUSe3IM594TbBFGPuOd8k0sCwmTTjnjbjBceg== X-Received: by 2002:a05:600c:3516:b0:389:f9aa:f821 with SMTP id h22-20020a05600c351600b00389f9aaf821mr1113232wmq.73.1647903365431; Mon, 21 Mar 2022 15:56:05 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:04 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 26/41] daemon.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:08 +0000 Message-Id: <20220321225523.724509-27-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon.c b/daemon.c index 94a5b8a364..cd07ae1643 100644 --- a/daemon.c +++ b/daemon.c @@ -134,7 +134,7 @@ static void loginfo(const char *err, ...) static void NORETURN daemon_die(const char *err, va_list params) { logreport(LOG_ERR, err, params); - exit(1); + exit(EXIT_FAILURE); } struct expand_path_context { From patchwork Mon Mar 21 22:55:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787861 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8384FC433EF for ; Mon, 21 Mar 2022 23:09:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231963AbiCUXKa (ORCPT ); Mon, 21 Mar 2022 19:10:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233422AbiCUXIm (ORCPT ); Mon, 21 Mar 2022 19:08:42 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39F1550B0F for ; Mon, 21 Mar 2022 15:57:21 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id h23so22040376wrb.8 for ; Mon, 21 Mar 2022 15:57:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QY3RPZnbq3SHnb31nrheJajcr08F9gHfIHpZoxfsMTI=; b=dMB219Hvf+CW1mso8K16QMxeRbzvGfvB4pzprijA9ADBXg/Arnr+9M696ok/KLP7Yx Vklhw2NMpxBWwNJAmS7jZ2ZlcAUSKgVHDRsZCHIcpb6isr95c1Gg8evmj76Mgrf/oCop hjBZ+9WdvmG+dbGa877uyJw7viMKQxz8U3azjJIie6lazOBQcIdSIuV19Q+f4TJr57AW ImV02hx6QwDyiBFNKa71XVkND+5TDl9AC1iVlnRog6hFKQbacvjjeqwDvAsTCtcoGizN 2Wf/yCa15yOaWavGpHqjKGofT3Dabg/CDb2Fv3x74VA0Pbt6BylgK960gIn3c3YVP+Rw H5dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QY3RPZnbq3SHnb31nrheJajcr08F9gHfIHpZoxfsMTI=; b=k6aFCRNxUYinqYzQY0fbEdEHspFNRWgp75EK3JhzIjuwnlTQs/5hECo62pr8SjgDsY 9DO+KWATgOvteWnWIiRLy+1fvARs4TC1nPvhgldaAyTy28nY7Qi7NLDiew4A1Zoqn+Cv L6eSoxE67hWma17b8MDfmDC3K2oi4BQ7YFDXsaK5MjIyFrmnnqONL5Ukp/qHypZP+VSS wGGsWnl1cXZNwnqa1+xJ6KeHcEhwaIxM9T/gi+mCXe/0kIuYjon+uWTodkQcW8jr3kGc YOp5vTPBpmv+k5FfXNm619Yxfip0npgIAhYozQs5eJr2blVVw0RLAhgg0A23+t7Nj5KO XYcQ== X-Gm-Message-State: AOAM533oqsj+aW+FG45v4PJ+M5c4NW0QSRpLlouufooqkGIyk/4nzJ6C 391fPcOzXTRdRucpkQEO48HbEtUU8fo= X-Google-Smtp-Source: ABdhPJwQgW9pyCe7V4ICWyelfzwCzQvn0WP6wkazYB5KdY6zlfFX7CltUBiPpHovyDirbVHwvzsV9Q== X-Received: by 2002:adf:ebc7:0:b0:1ee:945a:ffb4 with SMTP id v7-20020adfebc7000000b001ee945affb4mr20346143wrn.641.1647903366522; Mon, 21 Mar 2022 15:56:06 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:05 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 27/41] git.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:09 +0000 Message-Id: <20220321225523.724509-28-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- git.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/git.c b/git.c index a25940d72e..7b75e6e720 100644 --- a/git.c +++ b/git.c @@ -158,20 +158,20 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) else { puts(git_exec_path()); trace2_cmd_name("_query_"); - exit(0); + exit(EXIT_SUCCESS); } } else if (!strcmp(cmd, "--html-path")) { puts(system_path(GIT_HTML_PATH)); trace2_cmd_name("_query_"); - exit(0); + exit(EXIT_SUCCESS); } else if (!strcmp(cmd, "--man-path")) { puts(system_path(GIT_MAN_PATH)); trace2_cmd_name("_query_"); - exit(0); + exit(EXIT_SUCCESS); } else if (!strcmp(cmd, "--info-path")) { puts(system_path(GIT_INFO_PATH)); trace2_cmd_name("_query_"); - exit(0); + exit(EXIT_SUCCESS); } else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) { use_pager = 1; } else if (!strcmp(cmd, "-P") || !strcmp(cmd, "--no-pager")) { @@ -318,7 +318,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) for (i = 0; i < list.nr; i++) printf("%s ", list.items[i].string); string_list_clear(&list, 0); - exit(0); + exit(EXIT_SUCCESS); } else { exit(list_cmds(cmd)); } @@ -900,7 +900,7 @@ int cmd_main(int argc, const char **argv) printf(_("usage: %s\n\n"), git_usage_string); list_common_cmds_help(); printf("\n%s\n", _(git_more_info_string)); - exit(1); + exit(EXIT_FAILURE); } cmd = argv[0]; @@ -920,7 +920,7 @@ int cmd_main(int argc, const char **argv) fprintf(stderr, _("expansion of alias '%s' failed; " "'%s' is not a git command\n"), cmd, argv[0]); - exit(1); + exit(EXIT_FAILURE); } if (!done_help) { cmd = argv[0] = help_unknown_cmd(cmd); From patchwork Mon Mar 21 22:55:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787884 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 210E0C433EF for ; Mon, 21 Mar 2022 23:10:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230487AbiCUXLf (ORCPT ); Mon, 21 Mar 2022 19:11:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234989AbiCUXKD (ORCPT ); Mon, 21 Mar 2022 19:10:03 -0400 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BDD313F83 for ; Mon, 21 Mar 2022 15:58:24 -0700 (PDT) Received: by mail-wm1-f43.google.com with SMTP id o7-20020a05600c4fc700b0038c87edc21eso687451wmq.0 for ; Mon, 21 Mar 2022 15:58:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+V93n5I+rGRbi1qiV0MM8iJS8/0/yRXFSrKSN0u3jX0=; b=OFJETiTYZKf1Ywq9JmS5p3nTNAGruwvGfuTzzftNdhy07nT0buCSe+1ceqIQREQNuD cWzeYDBuv7gjmJIuNyhJUR/NrK/IZSAgp1pagkvPdKMY5t5dzDTp5V/JmrqK9YCB1o4P 2JPmHD6KFCa+Hl1jvktaxEBm5JTGLZqBvADNQe3rawaA9hhJtKuwhtBLtKRdhR1FVAjM 15ZHTtMRNpIrDh97tkowpNhPWSfyVRzaKXMlQVggu5NK0NacJp7ZZ1dbBPeymEoWVFM4 caVLL8ycfgeMk9U/CPRCnAvgp1Pf1gP9zJw6UGa256CxJB7XH5zfjg+5j1zW7UQkKBoS pIjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+V93n5I+rGRbi1qiV0MM8iJS8/0/yRXFSrKSN0u3jX0=; b=NlB9cskDNSSFYiUqJlEB9+77JvZvJQlvkP2LrAz2cOoJ2+j1BTKVgKLbm33/Hluqx5 L4L/iul515sb3Cuu6MGScZD1+7NMeL+Pyzv27keA9QHfnNWcd5v7vc8LTumr+3vpqo7f jtsNrl4pYoxEfaliY4D4iAsRj+IxipXL2ET7o6WzPr2pD0z/leLF+ri0ToSpUUgJU8qh 0WfPlvhG2+6aOQxY7iqc9v5oUQ8JL0sWjA7vXpq/fPgh/XpWt8uYwSCmDhRwd3zrDLVY XAM4fAGdKToRaE8UUiMMXtUkUhEEE3gLPLvaLWcKE9LlwgaLjVxmHObhOw+zHnJUNQkS 8oCg== X-Gm-Message-State: AOAM531mRa2AA5gOBxQMc/7HP6Mc4OhhJvXE4QSCkrT33MBBeder3EG/ XEYGCx89Otcgq3y1arHOwrXs3B7GaAw= X-Google-Smtp-Source: ABdhPJzdDVhL2d05zPytKOrdQwKdBNYqgb2mUCuL6xf5sdJ0J7nIigAG2pvYBAo5w1HAn5Q84r+03Q== X-Received: by 2002:a1c:cc06:0:b0:389:79c7:aee6 with SMTP id h6-20020a1ccc06000000b0038979c7aee6mr1139787wmb.47.1647903367939; Mon, 21 Mar 2022 15:56:07 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:07 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 28/41] help.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:10 +0000 Message-Id: <20220321225523.724509-29-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- help.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/help.c b/help.c index afd3af2412..e661dfddd8 100644 --- a/help.c +++ b/help.c @@ -582,7 +582,7 @@ const char *help_unknown_cmd(const char *cmd) if (autocorrect == AUTOCORRECT_NEVER) { fprintf_ln(stderr, _("git: '%s' is not a git command. See 'git --help'."), cmd); - exit(1); + exit(EXIT_FAILURE); } load_command_list("git-", &main_cmds, &other_cmds); @@ -667,7 +667,7 @@ const char *help_unknown_cmd(const char *cmd) strbuf_release(&msg); if (!(starts_with(answer, "y") || starts_with(answer, "Y"))) - exit(1); + exit(EXIT_FAILURE); } else { fprintf_ln(stderr, _("Continuing in %0.1f seconds, " @@ -690,7 +690,7 @@ const char *help_unknown_cmd(const char *cmd) fprintf(stderr, "\t%s\n", main_cmds.names[i]->name); } - exit(1); + exit(EXIT_FAILURE); } void get_version_info(struct strbuf *buf, int show_build_options) @@ -789,5 +789,5 @@ NORETURN void help_unknown_ref(const char *ref, const char *cmd, } string_list_clear(&suggested_refs, 0); - exit(1); + exit(EXIT_FAILURE); } From patchwork Mon Mar 21 22:55:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787880 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51FEBC433F5 for ; Mon, 21 Mar 2022 23:10:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232397AbiCUXLZ (ORCPT ); Mon, 21 Mar 2022 19:11:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234968AbiCUXKC (ORCPT ); Mon, 21 Mar 2022 19:10:02 -0400 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 502C558819 for ; Mon, 21 Mar 2022 15:58:23 -0700 (PDT) Received: by mail-wr1-f41.google.com with SMTP id h4so4690848wrc.13 for ; Mon, 21 Mar 2022 15:58:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YDYe+wAshZCSB7sN+NAhKi5Ef6AE28uHuKw5bIy9fLI=; b=VmflCwz/x3hGwv8YozmE8P/m90/zA1D/mXDgVXzqCUyk6+mDY+m6bpBZ0RomZm74Ct 3A1SkFYOdFKXLyMTLeo8a+11XEpofvbnZ1Q3WNkzZJ/d9NEY5emf9AL+v7R0YHG2o5BN K2p//+pkSmoylb7WWSzRBa42b/2005UM3seipxhZ5CIv1Vv96DUPGQ5wn6HiOGvL7J9P nczFmHt4VcjSDt9eR5+tioMTlhIrVP4He5ng6clN7pS3xjQbsIXvNoaYh1sBi3yLH62e irtSvruN1lpI9B0Urub38S0fH/DLWbr9Geju+LDhVUkXW1HQJUBgBMD6/ZJNZMsLyLzM cblw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YDYe+wAshZCSB7sN+NAhKi5Ef6AE28uHuKw5bIy9fLI=; b=S+lG2IL2sIH+Av/AVl0iF+UQLe12P61+VZ546LUboTDqjf0BwmZssSwuze71drbEC6 n4JbNwj5kVjmzPmao7rVzV/zar1zJhFrp36kwxAbTksQz0A7M/68VH8JiN1qRlp9czJ1 2/LsH0pvYnaNHwHBR8OV2t/JYMTspXOECL9VvEagZnLcIpmy12Y2Nl2FOHRt0uf7758v HuBAsli/qQocxd2g4wge36xf95eGg7W5pKNENi4fMtJklooYHA4fNRte8n+D2YkipKWk p0hUIBjZOEgpzDANMOekjWQKCzIDHtTV7/roZJRca1/IYVEDOGq8XHFfAahvg7hIz+IG ZJOA== X-Gm-Message-State: AOAM530NIYkJNU38TLRkNp6LGb/9sp6psUnFqzm4w25fcHRcdZwDMnXX IczY7JsIy4fhrA1DnvX4XN7Won9jzAc= X-Google-Smtp-Source: ABdhPJw76eMS+GQVfNpLgwoc7Jdd9aSxXYQXgo8ojdpXttw1b0n35Ovb4OOGlAzWI5wwGZqaEtwUDg== X-Received: by 2002:adf:f94d:0:b0:1e5:5ca1:2b80 with SMTP id q13-20020adff94d000000b001e55ca12b80mr20100755wrr.323.1647903368889; Mon, 21 Mar 2022 15:56:08 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:08 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 29/41] http-backend.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:11 +0000 Message-Id: <20220321225523.724509-30-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- http-backend.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/http-backend.c b/http-backend.c index 81a7229ece..932d92d70b 100644 --- a/http-backend.c +++ b/http-backend.c @@ -137,7 +137,7 @@ static NORETURN void not_found(struct strbuf *hdr, const char *err, ...) if (err && *err) vfprintf(stderr, err, params); va_end(params); - exit(0); + exit(EXIT_SUCCESS); } __attribute__((format (printf, 2, 3))) @@ -153,7 +153,7 @@ static NORETURN void forbidden(struct strbuf *hdr, const char *err, ...) if (err && *err) vfprintf(stderr, err, params); va_end(params); - exit(0); + exit(EXIT_SUCCESS); } static void select_getanyfile(struct strbuf *hdr) @@ -488,7 +488,7 @@ static void run_service(const char **argv, int buffer_input) cld.clean_on_exit = 1; cld.wait_after_clean = 1; if (start_command(&cld)) - exit(1); + exit(EXIT_FAILURE); close(1); if (gzipped_request) @@ -501,7 +501,7 @@ static void run_service(const char **argv, int buffer_input) close(0); if (finish_command(&cld)) - exit(1); + exit(EXIT_FAILURE); } static int show_text_ref(const char *name, const struct object_id *oid, @@ -628,7 +628,7 @@ static void check_content_type(struct strbuf *hdr, const char *accepted_type) "Expected POST with Content-Type '%s'," " but received '%s' instead.\n", accepted_type, actual_type); - exit(0); + exit(EXIT_SUCCESS); } } @@ -668,7 +668,7 @@ static NORETURN void die_webcgi(const char *err, va_list params) hdr_nocache(&hdr); end_headers(&hdr); } - exit(0); /* we successfully reported a failure ;-) */ + exit(EXIT_SUCCESS); /* we successfully reported a failure ;-) */ } static int die_webcgi_recursing(void) From patchwork Mon Mar 21 22:55:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787895 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 689C7C433F5 for ; Mon, 21 Mar 2022 23:17:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232486AbiCUXSv (ORCPT ); Mon, 21 Mar 2022 19:18:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233288AbiCUXSg (ORCPT ); Mon, 21 Mar 2022 19:18:36 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8902A31A2A3 for ; Mon, 21 Mar 2022 16:08:28 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id u26so4118414eda.12 for ; Mon, 21 Mar 2022 16:08:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/H3pUHeOhQe+SrPebatrTC/XrxWw4GQ1U24PBqYvkV4=; b=Q97Zs7EXP5LMOLKV81b7y+wYlq9rpxwD8fW9+5ZEswnao69nlrJHNsl9EY0QrlUsXA D9ZxrLZ36D8hdvXQK0qeUKEUnWMfWDNgfdKfubvZlGdwn/eEVa7RfeSrfODgXrwKTVzb /qHc9gRqnfBY7QsjvaaYiHzyE34RGkYSieS6DRg6EgmpzTNz116vHuWCG9kPBz0XmBH+ Pwl9SnLaPGS1OaXspPSTiinYUeLXiR73zFaXemiLlx4SRo2npFhnvoIBn9ZwyQr6bEDr EohED8fR5NxFEvEbTGXlKZ7RJ88mtkzUCIHcIMFusoiYk+O2yWVdiTm6987s4Y/fNaYR QE5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/H3pUHeOhQe+SrPebatrTC/XrxWw4GQ1U24PBqYvkV4=; b=wv3F9INCcGAw3OUZjXX6MLWW61w4BDp03IM/zizRnuDbml/s9g3ixoHIeCLUa/sqyH u0Hyv5kX/4Sc1usZ6NtiLVRslklk+hkoS45uDNP8VKgi9wK7BM7+Alg44D2cc38+zHsX T6A+TWNv40OCAMyrjnspuiVEzdxrZ4Oez9DsZh54uwhJv1mNO+QwD55OYgOI3QG3HF6/ PQ87uqMN3P7cC1myv0bXVB1feer4lJd1lWZ0ci3wM7smaxTjnIID9J9GBnH68JDVznXK 6eRQjUDLZ7fsQ+KYZxlBtzg9BRyMk5anE263d2TCTkxlMaKupfWMWZpf3Yom88sJl2vC MZCQ== X-Gm-Message-State: AOAM533uNoR1t1tQAdjqliie5Nw8wgi2i7tc1ReIXfGheenp7mfpf8cE rkWJfR1VTkjoPlKAk153Aw/+2GdM/pQ= X-Google-Smtp-Source: ABdhPJzvgZU5EAOM51Id2aFUMMGFOW29xwLkuYSO8KA6Z8JYxQwIXTNsJvkCWrwFlM5D3neG9Aaexg== X-Received: by 2002:adf:fb90:0:b0:203:b456:c71e with SMTP id a16-20020adffb90000000b00203b456c71emr20028883wrr.244.1647903369867; Mon, 21 Mar 2022 15:56:09 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:09 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 30/41] parse-options.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:12 +0000 Message-Id: <20220321225523.724509-31-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- parse-options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parse-options.c b/parse-options.c index 6e57744fd2..0ee82fb760 100644 --- a/parse-options.c +++ b/parse-options.c @@ -883,7 +883,7 @@ int parse_options(int argc, const char **argv, case PARSE_OPT_ERROR: exit(129); case PARSE_OPT_COMPLETE: - exit(0); + exit(EXIT_SUCCESS); case PARSE_OPT_NON_OPTION: case PARSE_OPT_DONE: break; From patchwork Mon Mar 21 22:55:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787876 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8D40C433F5 for ; Mon, 21 Mar 2022 23:09:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232279AbiCUXLQ (ORCPT ); Mon, 21 Mar 2022 19:11:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233319AbiCUXIi (ORCPT ); Mon, 21 Mar 2022 19:08:38 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1543267D24 for ; Mon, 21 Mar 2022 15:57:24 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id d7so22651534wrb.7 for ; Mon, 21 Mar 2022 15:57:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=okufmd3g37lt7+seSZmuGXonNGuxuUQkpeUSvUifxAE=; b=diXBsEcFOh5qLN3tT4YCLxpdZwhtjd4RyvrIbmXjtqrmNGpiMfuLnyPjr8Hg+sPUKH lwRiCjKizy3eLbIgtFuUI1ZW9HmmZXVpsoOaLWdXNPV9hSwjA2yI4zocHhGP5oubGNyQ Cv8sS4fqGzEAKyGgsfdTP1VptpmFLFN2urfapqqjdbFfxGP4U8M3FHQFYeMDIpnfYHNi iH1/c30BhK3s8VBHrQlDmRSTZy5UipDW7CvGEEeBLwCCUgU1PAMgwXZAILFCyukT4MjQ U3fNxs7jFi8ZsrPUme+mdL5FIL+wo6VX+yS3ZI4nK/qtqQt7BTxMHLvDzx4Dk8S3hKAr tqzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=okufmd3g37lt7+seSZmuGXonNGuxuUQkpeUSvUifxAE=; b=hMrpvJnyYAAepDFOIfoWJCPn9M+nHNGdUOk/H8e+NSoi5H4aUF4BRunKUEB0a5SoLc tsMC8OVvGJaTWP+spLkNQA3WgQxiO9bJw3pDIW9t4XMeq7eoylLsx64Uq4GoAHMFyQJb puzw9zFFtdS0W7RRmD1KDsxicqoN2dCtJF0f0YyzV1h/IUoJUFB8zByCZRlF5CZbCsL9 1Nwg1nTzKjSrTjAFuQ9orWTrgSsTqS3lEvafBT22LXOq7ya2JYreniZgTTj0v1XRZI+g pSuXbKVxLsZEXrZP6UhbdbhF8a7n2OKMgtjb01q3rZ8GLBuJJ6hlrYWrHEYqLwdO/PKn ygCg== X-Gm-Message-State: AOAM5316EkORBzfKuYL/Y+Wy8eKGVNnNLfBEx9rBB6vRH3IftiuQBm9o ytd/aFDT8qh0TimAXT5l30gePrtpjrE= X-Google-Smtp-Source: ABdhPJwGkE4UcGzoUAMTmK9VBfOkDKJvotsU195hCwgmNZXccLpSXe9JmOuO9Z7s21t0qT0zx0wiag== X-Received: by 2002:a05:6000:188b:b0:204:109a:fbed with SMTP id a11-20020a056000188b00b00204109afbedmr6177230wri.569.1647903370781; Mon, 21 Mar 2022 15:56:10 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:10 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 31/41] path.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:13 +0000 Message-Id: <20220321225523.724509-32-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- path.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/path.c b/path.c index 2c895471d9..6639bab7b4 100644 --- a/path.c +++ b/path.c @@ -915,7 +915,7 @@ void safe_create_dir(const char *dir, int share) if (mkdir(dir, 0777) < 0) { if (errno != EEXIST) { perror(dir); - exit(1); + exit(EXIT_FAILURE); } } else if (share && adjust_shared_perm(dir)) From patchwork Mon Mar 21 22:55:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787860 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5154BC433F5 for ; Mon, 21 Mar 2022 23:09:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232363AbiCUXK1 (ORCPT ); Mon, 21 Mar 2022 19:10:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234310AbiCUXJ0 (ORCPT ); Mon, 21 Mar 2022 19:09:26 -0400 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5C974704D for ; Mon, 21 Mar 2022 15:57:53 -0700 (PDT) Received: by mail-wr1-f49.google.com with SMTP id b19so22634186wrh.11 for ; Mon, 21 Mar 2022 15:57:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZmbdCKhUgG79oncaeepOLFW8cJAWGh4RtIWAJYt7I/M=; b=ElmGyJkfBoezCSXBGrmeaK3u/JYpSVbJTJrwGHimIZRmlopRe6ldt/mHvoytACQ1nL G+On3hEUsj6ZWgA/oswBdRDMdLvumgyJ0qnQvFFc1i3qwCesLKJEC57nmItcyGaevwVX aqMManInD8iTQ14o+NOhrFAgpqeiq/KsRqoh81WHGTXIktdGX2NOApTGxQDZ1JHQpj4P VsuUgxRWkboW4qb78S+mJz9h9RU/xpixiEeN0rG2lowOQg2Mam77yxq07J9y7YI3X9G9 RX3drSev2Uk2f6OPqiptSSQ/WoKfyLK561Z0W8TwOXsxRBRnV5GxdGaMvFBTFY+Nrr9l m5dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZmbdCKhUgG79oncaeepOLFW8cJAWGh4RtIWAJYt7I/M=; b=lba4HRxMmCdyuzPkvooCNW3uYZWv7UfL/kJVOihnHwxdxpZhu26RlSDNs/BqmfqUOP UPTMgI508sZMABNBgyTnBGQ7l/0Ttz3awpfjf/FvZwPK9yzdI9sGfiD0RwIVjEwmaJ6j BBQI6i6a8/0ZEXEvyuyR4r2c05TpH92T5/0Z3tBx1ifTe/WDNEPnx3f7StsD+a74iq9N QGp5RXFjAxlcDBeDpmg0jcdQKFMtZ7XeV+LIr53V2LB5m/3M/CSEf9qrfpa9Ufedq+jY CZ61oKL2v5WZWNTP+fNdUo4KxAnYab1G6N+v1+lD4c+pnIkYcyUVjJ0lPC6Jg3G0EQRB ST1w== X-Gm-Message-State: AOAM530Vrgxkp4dRh2PKNpMCw7he10za5f7h5lyjQgZgGpzyYFaIGKgz igmtI8VjoJCFcfYuZM6WCsN97H3nT/k= X-Google-Smtp-Source: ABdhPJwFKUqbBhIag2pLhK9B1xP6p/WAvn3RetZYv2bZ2fm2FhkcFkSs87IAP4pA0fwcPJklUjWLRg== X-Received: by 2002:a05:6000:156e:b0:203:d6e6:bcd0 with SMTP id 14-20020a056000156e00b00203d6e6bcd0mr19478950wrz.135.1647903371679; Mon, 21 Mar 2022 15:56:11 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:11 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 32/41] remote-curl.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:14 +0000 Message-Id: <20220321225523.724509-33-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- remote-curl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remote-curl.c b/remote-curl.c index ff44f41011..da61168c6f 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -1063,7 +1063,7 @@ static int rpc_service(struct rpc_state *rpc, struct discovery *heads, client.git_cmd = 1; strvec_pushv(&client.args, client_argv); if (start_command(&client)) - exit(1); + exit(EXIT_FAILURE); write_or_die(client.in, preamble->buf, preamble->len); if (heads) write_or_die(client.in, heads->buf, heads->len); From patchwork Mon Mar 21 22:55:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787874 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B4D9C433EF for ; Mon, 21 Mar 2022 23:09:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232042AbiCUXLO (ORCPT ); Mon, 21 Mar 2022 19:11:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233290AbiCUXIg (ORCPT ); Mon, 21 Mar 2022 19:08:36 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20E4D2FE67 for ; Mon, 21 Mar 2022 15:57:22 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id p184-20020a1c29c1000000b0037f76d8b484so366988wmp.5 for ; Mon, 21 Mar 2022 15:57:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Hrqf3sc2tLzo/0SxSSl2f0FvWbdi52hqNZQvOYAGboU=; b=CRmcfez7lL1Sw/RFJZIoOWPg+JE5wDbcbZGmNTfbjf4rBz6vPQsnyRxTQnoi6Mu037 5MO+XlVtWpLg2LmwxDb63/lSTwTXhlAdOIf0o0VgqXlxGr8Rv2jRMiHf6FmRbcTxESTq Sym27SilCFs5MTCFg6b0eIRntqQ3P3okFR/r709/kWXsxSClgM05TI++gExMnr/WVLBc tbSiwty4D980nhwj15zF8uT06tVTOBP2e9t4QasJqC+cyoE1UiLy7843eHqfDtiDHVTh s7/IXYUmXQPLa4fwy/n0IoNerVN35ROhAVRlSahIM+vPaokFw+iJarQ4l05wRFfl5Sol Dn1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Hrqf3sc2tLzo/0SxSSl2f0FvWbdi52hqNZQvOYAGboU=; b=a1p1mSGhm/VlEkpzoCgjdbfK7JGPNK+PiiHM5UZYSkLkZN3a6INZBk3IQ+NHYF1+xM WR2j0pS23RQUX81Ia0kKLdCe+XwmIxBam+oOMKxw23t76u6ADeiIBo7TUIDhFN9s6jWT MhhjlnrPeKL9XrRJfXFxlIi5AQMLRcYbVdO453YTFw8jvXKZ/ahddQtBRsA1AK6IYDUm YtjmZzXOpfgJGsm70cBgQEeP803+HWUrUntEqcf/QuwbIkyn5SN4uN/YGX70vFkqnHB8 0ylxwXcH0zmkFUtzE5JPqbxoYnvQiz4nHBy0BxO6UxS1MK6sFxSUbV9ZdS0GUE8XCEQR /0Lw== X-Gm-Message-State: AOAM531pvnxrYo6LL/veOSbpkV+q3yWBfXDwfWGjWPI8Q+b/KPYNIdLG 7rBM/lZmlXPno/K1Y5N03CiIBFOsmEY= X-Google-Smtp-Source: ABdhPJxl6esMWi+St0bHQlUPjFl3+qEfsPuzhsm7632kHdQSOLO+2YS9iHVpEkKDNOZggcQMV4ghAg== X-Received: by 2002:a05:600c:3c8b:b0:37f:1546:40c9 with SMTP id bg11-20020a05600c3c8b00b0037f154640c9mr1078239wmb.161.1647903372597; Mon, 21 Mar 2022 15:56:12 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:12 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 33/41] run-command.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:15 +0000 Message-Id: <20220321225523.724509-34-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- run-command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-command.c b/run-command.c index a8501e38ce..5a5d865716 100644 --- a/run-command.c +++ b/run-command.c @@ -319,7 +319,7 @@ static void child_die(enum child_errcode err) /* write(2) on buf smaller than PIPE_BUF (min 512) is atomic: */ xwrite(child_notifier, &buf, sizeof(buf)); - _exit(1); + _exit(EXIT_FAILURE); } static void child_dup2(int fd, int to) From patchwork Mon Mar 21 22:55:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787856 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85679C433FE for ; Mon, 21 Mar 2022 23:06:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231942AbiCUXH2 (ORCPT ); Mon, 21 Mar 2022 19:07:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232127AbiCUXHS (ORCPT ); Mon, 21 Mar 2022 19:07:18 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00FC713FBA for ; Mon, 21 Mar 2022 15:57:40 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id h16so8854559wmd.0 for ; Mon, 21 Mar 2022 15:57:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=34mMrqgBbfnsuYKOqRocmbdX83HR9fyg+7WKRyJQFW0=; b=aXurSz6SlMik2hXi/FI6qz93QD2YFjjttuVM4nsav3RGYNawnxnYmAP8AZCD0HpiYC q0zVDGR2HgyUBqhI2vjPMyrN4crM4x/gmWPC7tTmH9lWqYYWy9rd140IUiCJ6M2lKqUp YFymdSAfHr4SptW7L9w4sCJlMs9PGp1akD52qK42aaX3I1ZillNGRRPm+QKon0CyjMOP P//F86vs4OFsmiGTjjE7xjII4yYxdcScCKQTQcUi04NLiNHZ9vN/Yi5l5De+489MgnWq s8E7JgWVTx1b7WKXai04HigU1XAOO4H6tZTs9SxakTZSoyx2Aiewm4FCp/r/OYsJY0Bl AQ/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=34mMrqgBbfnsuYKOqRocmbdX83HR9fyg+7WKRyJQFW0=; b=ZePW8GhnO27Mc+PSGL6g/s9ge/XJB/sAW24OLeS/V31VQvGefVlpgLSXrNRPmoolW4 X5Xb/fgpLePr/+DuVZLdtXR5RwESB+QR6HuBA5ptKwkmW12YXNn/+mIUYcu5fpT48UQN V4+XbkGbRGirlF52laInXbAspuyOBcv88RNHgxhE643lFKDQlMTqP5NHnJ5Jp8lZV5+5 aP3L6gE8cqPqNscmanlIYbg+UTizZKm2JGOd9qMIMRDSlixCl1Hzn1R4WhukXyogj3mJ oYuajGZn0j7A42+jJmtquqNzVLwW7wpcxcPZTGlobJhwe40WcZqEPwidl0wY0MhMqUEq xcVQ== X-Gm-Message-State: AOAM532KvZ4bQzEocLiqAXRZBhonXGWPX0Re3KKAHxaqhLnp3HF6r/5e VtEXS4/8pxK31Q2noizgD8IKzeRadBg= X-Google-Smtp-Source: ABdhPJxElPQmuepytpj1OtrRKVKjHA11B7Iokvuk0Uy3Uy3wCLwmq3tcfIlX5lAGH1tcPS+GXAlFIQ== X-Received: by 2002:a05:600c:3509:b0:38c:b03b:b3c2 with SMTP id h9-20020a05600c350900b0038cb03bb3c2mr1146503wmq.81.1647903373725; Mon, 21 Mar 2022 15:56:13 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:13 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 34/41] setup.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:16 +0000 Message-Id: <20220321225523.724509-35-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.c b/setup.c index 04ce33cdcd..f5cb3f30a4 100644 --- a/setup.c +++ b/setup.c @@ -1508,7 +1508,7 @@ int daemonize(void) case -1: die_errno(_("fork failed")); default: - exit(0); + exit(EXIT_SUCCESS); } if (setsid() == -1) die_errno(_("setsid failed")); From patchwork Mon Mar 21 22:55:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787897 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB0DCC433F5 for ; Mon, 21 Mar 2022 23:20:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232454AbiCUXWU (ORCPT ); Mon, 21 Mar 2022 19:22:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232545AbiCUXV6 (ORCPT ); Mon, 21 Mar 2022 19:21:58 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6402A37490D for ; Mon, 21 Mar 2022 16:14:09 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id r64so9415219wmr.4 for ; Mon, 21 Mar 2022 16:14:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZsgTYiiyI1UuwLV+Sl9E4OerIW9rlcp/Vf3NQEYip/s=; b=X6PGHeOQBuXD78BUaXVAkp1E4bg/XEyWtohb1WEFzvIsIU8DzSIuSJ+mVFU1ChbjMc GMUooPud0Rc+FCIdkzfJt9njpAH7acHyPtLLcHWKB9A1yWHO83jK7Tl3Hr44BUUf695s hk1nLxmv7hW87saWufoarC8GA64vACJ4LzIv8t3waxYdWfU7OdKQUjJOi0PDZ8HBMEkW vub9kh06G6B1jY//3NrdT1xFQW4+AwEAQ0gqddniEeKa5/F3XnWY6/CqOe/SckCU5Hwj yeS4yP9fHXuleEjcpgKLo8MIBKLvu6plGhu8cinOo9MoJtTuHSIMkpuXi8p2g+Jd+gMR cJyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZsgTYiiyI1UuwLV+Sl9E4OerIW9rlcp/Vf3NQEYip/s=; b=FDmxFrbpPwFTWL5nHc2R5XukU7WLK6LYM2NoG/VaflkYTT/MaPOUJLRtqVB7pm6iKQ gaqG7eU223ZZlgwh8A8kwyONp8jso0scPHMas3vfmeEGNCwxHMXgJt49gGuLx7eCICWO KE7QQwMaTW8y/ZcbZGRU0LfTcnGyOJnKP32hRQ4oj+WRbbzUZ9DBE7d38jNS9n/0WCFk 6ZDnSMsar8j4QBh7d17A62uzQ6oN4Wb2h8otwBSzXHEmvl2FNsLiFmdo75+rsUMIp5Af OPx0HEAIBSu40ZeatEnfY/K/2n8+5tHt2Q2G3bNV3oSRCygFcm5lYFMrFgzXzABG7ODI T2Mg== X-Gm-Message-State: AOAM530bD/91vZ/BDtLNqjjN6MJk7906zwY6Sv0L3836aFAiqVdoTHhF eiI7131b+fLGsg3jOWqBgwUu+7eeh2I= X-Google-Smtp-Source: ABdhPJxVtBvydYnhrMMBFsBGnRYh5aYU7knjQGgg9wYmHfzhblQSGMVzYeSLZy4IOiRF8grTKKLMlQ== X-Received: by 2002:a1c:7518:0:b0:37c:7eb:f255 with SMTP id o24-20020a1c7518000000b0037c07ebf255mr1097093wmc.29.1647903374605; Mon, 21 Mar 2022 15:56:14 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:14 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 35/41] shell.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:17 +0000 Message-Id: <20220321225523.724509-36-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell.c b/shell.c index 811e13b9c9..d2d1718e9c 100644 --- a/shell.c +++ b/shell.c @@ -146,7 +146,7 @@ int cmd_main(int argc, const char **argv) "and have read and execute access."); } run_shell(); - exit(0); + exit(EXIT_SUCCESS); } else if (argc != 3 || strcmp(argv[1], "-c")) { /* * We do not accept any other modes except "-c" followed by From patchwork Mon Mar 21 22:55:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787883 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99E14C433F5 for ; Mon, 21 Mar 2022 23:10:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232425AbiCUXLd (ORCPT ); Mon, 21 Mar 2022 19:11:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233306AbiCUXIh (ORCPT ); Mon, 21 Mar 2022 19:08:37 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E2D351E6B for ; Mon, 21 Mar 2022 15:57:23 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id r7so9412210wmq.2 for ; Mon, 21 Mar 2022 15:57:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7dHAMdZPEOD8YhLsDhMpTMCV6/ucq37yxEPYK+1Zz9s=; b=OZpCDDStulYcYFXz38STDhQ+S+KmMj58v/0C9uFtcd3iMuRQAryekpWpPryLvn5O4A 3hsAmataQ9BvLM6zkFi1XIWgs1cJ/levWVfKurlDX0B51TPjVRlDU1vTwR1ZHTx/D2zk bOu73EZ5YS8Z73jq2BnVAXAH+XzgSPIKAxtsPPJZdDXdkgOCBkR6Lg6Yz3meCEhfE546 E2nHIanyDWxXqj4ti/w2CSKJA2c0cwZnCf6OyOVnNc6VvWEIK1zzHJJRddXfeOZujeIo q469JY5NAMiHd6Qto+3CKznFtm5f2jIlRDZbJeMoVK23DDS4JXQFsSMbVypksUUMAMjL oU0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7dHAMdZPEOD8YhLsDhMpTMCV6/ucq37yxEPYK+1Zz9s=; b=DF9FUIHHznCpuukX4tW1Q1jwj1LBB/1is7kJ6UZ8DPQov4EAzyFKco29YmhF6HU7R0 3NbkRv9X+fzovvIOVqoZhOGlrAFEckluISWlbrMjzKMDi/Yso61kpXY7p2No2Y1e6x8j pcpVFnfrlDBFF4oU/pNBGFk7V9pQ0zKQir6fCXvnckl0B+WTEE1Tha3wnZrOE6hWWKam G6Wz6T5yWP3P8+YJMNxWM+AOVTRCuPOFYmkKkVaWgsFVaGfS/ceTA/ScNiWVZ8yU7+Mi YHGupPb33PLYRII5dF65aab/Z9yxpoU0Ed1Wq+4zf/VgsfIETqgDM1hVbswLMpCKu279 l/IA== X-Gm-Message-State: AOAM532rM5izcqgYM9s7NKkuAJ3Xi+Hmf4aGpwZjOzhCR7hn1DNawgVm pFEkTsOJ//wqTdxz3yUTP82vCSmW020= X-Google-Smtp-Source: ABdhPJzRzS2OQK/sIjANDSJzaJKcZpr2EFdIbAO4WBI3ZuT2jKcEvatsJJbVFNJWoMFQouBXSzp65g== X-Received: by 2002:a05:600c:378d:b0:38b:e12f:edde with SMTP id o13-20020a05600c378d00b0038be12feddemr1112146wmr.69.1647903375615; Mon, 21 Mar 2022 15:56:15 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:15 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 36/41] test-json-writer.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:18 +0000 Message-Id: <20220321225523.724509-37-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- t/helper/test-json-writer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/helper/test-json-writer.c b/t/helper/test-json-writer.c index 37c452535f..61c5a3dac1 100644 --- a/t/helper/test-json-writer.c +++ b/t/helper/test-json-writer.c @@ -322,7 +322,7 @@ static void cmp(const char *test, const struct json_writer *jw, const char *exp) printf("error[%s]: observed '%s' expected '%s'\n", test, jw->json.buf, exp); - exit(1); + exit(EXIT_FAILURE); } #define t(v) do { make_##v(0); cmp(#v, &v, expect_##v); } while (0) From patchwork Mon Mar 21 22:55:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787873 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 915B2C433F5 for ; Mon, 21 Mar 2022 23:09:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232190AbiCUXLL (ORCPT ); Mon, 21 Mar 2022 19:11:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234642AbiCUXJj (ORCPT ); Mon, 21 Mar 2022 19:09:39 -0400 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7224E331455 for ; Mon, 21 Mar 2022 15:58:05 -0700 (PDT) Received: by mail-wm1-f52.google.com with SMTP id p184-20020a1c29c1000000b0037f76d8b484so367044wmp.5 for ; Mon, 21 Mar 2022 15:58:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WuVtDQaIHEBAJfbLOr9Szg5DhnU3l/HI2iWx9LjxB/k=; b=cq1OWDXq29gVkLk1lcTgxrtVF1pBwdUgyRy07VWyn4ncs+1C8ywk3Vc8IHHRiNTiCA uBBVZtEgR8Quv+Lur+lJz0T2NpByGaUmfBrBJr3LUPLfP2KDhUHfHD8wY5JT/2z5LOat hrwa4wL9iQ+4f3flXp+zCuAOBE/33dDUFZJInn9qg9k5NVlq3G36+PwjkSozFBpsXZQY K6/ShO0cDuXjTxiol+CcngEnx/kVjTMIe7cCVgspdtkyrQeQfEgY3IOcmZKnTPfKCUn1 QR5d8heq0wktsss/+u9H2D0TYD4yW/zdxuYRRFkW5XPEGf4qEA6MypO1+ySuVOaoLjPP ie2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WuVtDQaIHEBAJfbLOr9Szg5DhnU3l/HI2iWx9LjxB/k=; b=dLJdlIw87XOlOac4G7RC0ojemXRS/7lAxLkvztwPepyw2IvVZXlG8D9Vqzrd/02zwf Eg7Pw/WnhKeioQxlD1uQJsDWfvRFNeca6jzbj7EbXyQ2VjYLlYgDDqQ7WW1sb8mnLYOA Gy2UwEIQuaoLbZEf+wdEUvx/m38Wfb+Z7IbOZ7+BInrESOrGWwV74FZCHpHBU01cYuMm SoIBzU1s0aGzbYNr8Y5oCi3RQe7xFI8zd8Gvx7Lja9LDo4OWnKXRc8ierEg9rU9BSwEh bKBmmzz/qveX1XpDDmp/eVnBL8mqro0arWKJE3NQdtZgLfD92dyFMi1Glywa3Ruxx5Hy XIlA== X-Gm-Message-State: AOAM533fRmKqDDXuxT6S4SiGRd2T2dipVCbQ07igX5ddsD1AKUCCIQtq jyNVOxFSZHFs3uvni4Ay0qyiI7Xingg= X-Google-Smtp-Source: ABdhPJwJhGjiiWra4W9SqmL5XaAcv8NiujquJHdEKZ0pfp34p9WPKFjUyA37tUcfYQWm/oh4UR2plQ== X-Received: by 2002:a05:600c:252:b0:381:3461:1c64 with SMTP id 18-20020a05600c025200b0038134611c64mr1131044wmj.94.1647903376508; Mon, 21 Mar 2022 15:56:16 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:16 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 37/41] test-reach.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:19 +0000 Message-Id: <20220321225523.724509-38-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- t/helper/test-reach.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/helper/test-reach.c b/t/helper/test-reach.c index 2f65c7f6a5..b5c4cbf6cc 100644 --- a/t/helper/test-reach.c +++ b/t/helper/test-reach.c @@ -40,7 +40,7 @@ int cmd__reach(int ac, const char **av) setup_git_directory(); if (ac < 2) - exit(1); + exit(EXIT_FAILURE); A = B = NULL; X = Y = NULL; From patchwork Mon Mar 21 22:55:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787869 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F15BC433F5 for ; Mon, 21 Mar 2022 23:09:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232096AbiCUXKy (ORCPT ); Mon, 21 Mar 2022 19:10:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234517AbiCUXJe (ORCPT ); Mon, 21 Mar 2022 19:09:34 -0400 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1148A324D64 for ; Mon, 21 Mar 2022 15:57:59 -0700 (PDT) Received: by mail-wm1-f49.google.com with SMTP id o30-20020a05600c511e00b0038c9cfb79cbso458448wms.1 for ; Mon, 21 Mar 2022 15:57:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s+6I6EC/7xROz/VXlJztaYqPHV7zcNe0TOOyNlcfuSE=; b=JJwno/tC0+/vYnEiyjztR1S78OxUfXrzZxQ5ylqs2RdgYLEHHZLZNi/MdfAJxhs5+A 7z7SvRA7b5qPtpKY1zCztrUfW50CjYinveUrW4lUbS3apoTxonWlEHfKeClQz7P2doUR M3b4/uSZviYuvRpqqZSNxHV+J4tL+rtCWxoGX7Xo9Ouf+0hOtHdy4CUilYLaUO+aZv1Z kFiJPKZqUtiac7sq0/zb96skJFa1mg7tpVPZ+FjXZvDUhLToiwY4GVrp2S94Smpr5JLM 7GvVhs/+z83DVF3sdgclft5rOR+o0XIUWRP3IBCWFg97xAWkUyamRsH8LOHn/tWN31k5 syVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s+6I6EC/7xROz/VXlJztaYqPHV7zcNe0TOOyNlcfuSE=; b=QbHldlOLBbr3ggJcIXfI6U/PJRsIU6DnzL25CHM/Aa9FvbclJw9WUFC4hSXh2W9M4f JWZv3sLNAz5U80dcAFq4nFFKDy38G2QriMNwZ+LIuyCzZhg6UONx2p/y3Y+UXqEcinmp Nb5gFrKtMd8YCYCR7OY8Do8Y/58FUXwy9ZO4NePe/R16dTnAh4XTd/USxWo9R6ON3l6T 3E3/MDma4wh436Lry5WMNJNdKA5syMZ2Zg+Zn8r0sk7VvJ9q0FxvvPLmFjPOsz35APvr 6wEJM5ZN0zseZxXk9x++qpTVIWQBbWUDJwuFk82aCgE9tQZor4Phyogh3lBN0Li6B1ZU 71hg== X-Gm-Message-State: AOAM533gEi5q8kyAJMiRaV5MtmCBZH7qul8H313pXhGnZzT8/ZHhVn8g dZLvJ5T8nQJZZ3enigG6Wu9j79zOFQo= X-Google-Smtp-Source: ABdhPJyQlD7oorMik26Dfjvdaqi4skSWdT/PRNs0CeDtMmONI4K/kOmuO6vo/KlgmKb7sZDq2bszKQ== X-Received: by 2002:a1c:7312:0:b0:38c:6f75:ab28 with SMTP id d18-20020a1c7312000000b0038c6f75ab28mr1133332wmb.19.1647903377485; Mon, 21 Mar 2022 15:56:17 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:17 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 38/41] test-submodule-config.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:20 +0000 Message-Id: <20220321225523.724509-39-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- t/helper/test-submodule-config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/helper/test-submodule-config.c b/t/helper/test-submodule-config.c index e2692746df..d4608300d5 100644 --- a/t/helper/test-submodule-config.c +++ b/t/helper/test-submodule-config.c @@ -8,7 +8,7 @@ static void die_usage(int argc, const char **argv, const char *msg) { fprintf(stderr, "%s\n", msg); fprintf(stderr, "Usage: %s [ ] ...\n", argv[0]); - exit(1); + exit(EXIT_FAILURE); } int cmd__submodule_config(int argc, const char **argv) From patchwork Mon Mar 21 22:55:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787885 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66BEEC433EF for ; Mon, 21 Mar 2022 23:10:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231463AbiCUXLi (ORCPT ); Mon, 21 Mar 2022 19:11:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231658AbiCUXKL (ORCPT ); Mon, 21 Mar 2022 19:10:11 -0400 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EC155939D for ; Mon, 21 Mar 2022 15:58:32 -0700 (PDT) Received: by mail-wr1-f52.google.com with SMTP id p9so22621471wra.12 for ; Mon, 21 Mar 2022 15:58:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DAO9FjifcwP3BPmDlwDJciC8uSNJdsukMFMsbZiEuZQ=; b=Zk23avRVrj39hQNfSuS0FgzDRi6zDjANcEiRgUmLi2zCLKZTpAbmnz///cp0swBpss +ektmGNXalxrBNQ8+M8pJ1n9dR4vHtCUMfWKQQ/NfZ93DlZWe1k4Uh+aSI6VcXGLz73W ykQZcC8HpSErmYFj5+/YM5tBuF6L52tuEr81Z5Jak5+QtLyzFUqJLkVsaTkOtGVJVzwN 4VoBDmzImgbHTqtTpgKD4N49PU9tdqbiFvBZQ5ijOpogQmUjAjjrZvY4UeD4XGDVs4Hq hPPkUF2G/7OogG5tnclpyzATIURfBcOdLZsbEmHU+Fk/wNw/Cua5MpwMkmikQbCdLttQ aokA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DAO9FjifcwP3BPmDlwDJciC8uSNJdsukMFMsbZiEuZQ=; b=qqxVxJpH9BwZPrmc1eFl6EyCTbLkriE6TFwMqTQmZN/gpz3/vSmr5Wxkg4G2JJI8Rq 0dh5T55SiYZizCDRgzxijoudjyXJaYx5+gqBLaI8pi6H0uieqHJ4tJ/3MdNyOwXNsbji SuTtRMU1Lcz6XWzFhZy/mTe+U+roACK9YU+OJSfox7Swi08VNhCCN//ol+pZdUDVTWsz Poz8GXl1RLz4YJ7MFuOa8E59bB7v9v7FTldKzElNYcpayRtC1wqBbMhB75iO2VsBQ53Q oEu+7WFNljQhZsaO7yNeyICRGcjlidhkQrb5+sEgup7WreiWSjPd2+mQQf4U45h+YHgF MEpg== X-Gm-Message-State: AOAM532HnXJvK0+yPxZnc4G2YpIKT+5xVHAt/Rvx6+ePC09tVLmLpSs2 8JJKcpcEcAf+YzeJIIItQk5CuJIuWxg= X-Google-Smtp-Source: ABdhPJx/TYyfak8PQKuMQtPh+31ejI8BzX1ssVJJ5wtg5A2CvTPPXmWDO5BnD8W68Jf1dGd5yp/JNQ== X-Received: by 2002:adf:fe8d:0:b0:203:e02e:c6c7 with SMTP id l13-20020adffe8d000000b00203e02ec6c7mr20421625wrr.37.1647903378301; Mon, 21 Mar 2022 15:56:18 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:17 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 39/41] test-submodule-nested-repo-config.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:21 +0000 Message-Id: <20220321225523.724509-40-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- t/helper/test-submodule-nested-repo-config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/helper/test-submodule-nested-repo-config.c b/t/helper/test-submodule-nested-repo-config.c index dc1c14bde3..e32b68ceac 100644 --- a/t/helper/test-submodule-nested-repo-config.c +++ b/t/helper/test-submodule-nested-repo-config.c @@ -5,7 +5,7 @@ static void die_usage(const char **argv, const char *msg) { fprintf(stderr, "%s\n", msg); fprintf(stderr, "Usage: %s \n", argv[0]); - exit(1); + exit(EXIT_FAILURE); } int cmd__submodule_nested_repo_config(int argc, const char **argv) From patchwork Mon Mar 21 22:55:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787859 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07194C433EF for ; Mon, 21 Mar 2022 23:09:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232342AbiCUXKX (ORCPT ); Mon, 21 Mar 2022 19:10:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234710AbiCUXJq (ORCPT ); Mon, 21 Mar 2022 19:09:46 -0400 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44DFD3654B5 for ; Mon, 21 Mar 2022 15:58:09 -0700 (PDT) Received: by mail-wr1-f46.google.com with SMTP id u16so21648627wru.4 for ; Mon, 21 Mar 2022 15:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FnITzvNqQkosIVLcL7E6KVmr8OjpAtR5BO31KpKgruk=; b=Kwa0CsBQjyX6MH7gfKeAV9xBbS6oWHL92EZ01cUIMDFbcxnRhMExtj4biHA+bN8OCe ZVJq7MGnYYmsuWDFmULAqX4zxXfa+1MtntqJeXyGdtBvCyV9Lqc2LDmqbi/xNMFeN6zt SUkzntfSK/PZChrypp1l9cXCCO+QbPLQx8lCG54agbBc49OVLUlzUB/kP0sfIFQ13UmY AJ86U2MdizJi8hHS0eFauluzM0fpvyhE36rETuWt2QBvevS/ymjSHGyByekhrftb6UwN xfPjkicl7N0MdHIAr/3DMIvQCAoB1YNslKCQOpLXYfm1S5eNBJmjJxBywTfumvQUhIkK CNNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FnITzvNqQkosIVLcL7E6KVmr8OjpAtR5BO31KpKgruk=; b=66w/idhQZtz7UgMnQFocwFaQbaM1pj9L3UkpJ3fjOaQofhdyL/pgL2/sT6CDk3moea SNcmFS7JWcbNXAlJonoU35VSNppRlWOzg70a/DKUvB9nqPNm+s0FUAf15tPui6qUb3Ij /ObnH+pp4BKL3zN4cWCj7VcTUYKeKnqGrv4eG1aTPGBGiwffm5FncS33T2camYGiYX6l +NfPbLp0yNOFoUNmMe2ePrLjGRpf+SQqhKZvNVVmfpQ/AgEwLBU2ntFus3i47og6M/9s uoOypZus2leNnEJqQxsp0h2oDzeWmj12YWnc8Hf3atq1LaN+SoXVx7+y05jWsKZKM9Kz SXig== X-Gm-Message-State: AOAM530xGEqGDBCpMJ3bCfHX+HyLRBUYUiXPOYJ9eV/inYNwYrtJq2Er +txxHGzmhOigXg76x5KNiChcPVsbcls= X-Google-Smtp-Source: ABdhPJyS3a7jRdTSd1GAkc/9SUAwaVfzLRgf76ozYd+IJfsjK1c51/mi3FNCmiWxe3E3vHbeLkfpvg== X-Received: by 2002:a5d:59ab:0:b0:203:cc07:8d82 with SMTP id p11-20020a5d59ab000000b00203cc078d82mr19078919wrr.688.1647903379155; Mon, 21 Mar 2022 15:56:19 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:18 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 40/41] upload-pack.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:22 +0000 Message-Id: <20220321225523.724509-41-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- upload-pack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upload-pack.c b/upload-pack.c index 3a851b3606..1683d80c4d 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -543,7 +543,7 @@ static int get_common_commits(struct upload_pack_data *data, return 0; } if (data->stateless_rpc) - exit(0); + exit(EXIT_SUCCESS); got_common = 0; got_other = 0; continue; From patchwork Mon Mar 21 22:55:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elia Pinto X-Patchwork-Id: 12787863 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 846B3C433EF for ; Mon, 21 Mar 2022 23:09:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231346AbiCUXKl (ORCPT ); Mon, 21 Mar 2022 19:10:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232909AbiCUXIO (ORCPT ); Mon, 21 Mar 2022 19:08:14 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F0924D279 for ; Mon, 21 Mar 2022 15:57:35 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id v130-20020a1cac88000000b00389d0a5c511so407734wme.5 for ; Mon, 21 Mar 2022 15:57:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HWFQNaLQ1qGE9NzpNiAvS9tCCHxkA3GqlMctd4rLrSA=; b=RYilpVycFOjK8Yh46GZ+k9WLM1+IfXHyD4UWxkSsDzHfCtwudRpssnJd2UaAPdloRX lhsrE/jwzX+MIAKuj4DqJsaHJOFDwqLCD6BTkthOvGoT7dh6vInAQx5eFFvDviBFJtar hrE2VgylIfZkMLTRm+fLR5rAUtEduEq8nh2XCM5Jo5k7asmScfb+RmvHAIJgLOArKRy4 m6lWyLhflrsXF7XoAEMl543VjXDYw+XFEuyl543xbxenme+Tw9kF+vY34TFskG33NcCQ UqUFOjy/dRugeQPiO/Mo0GLMZkPweWwoFpR8a+mV93ix+So+N7gJA61GfqMuoxPPzwg9 HcnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HWFQNaLQ1qGE9NzpNiAvS9tCCHxkA3GqlMctd4rLrSA=; b=Rn1VHcutX+i/zN7U59h5h0LT8c/A2EY2uT1s8bddvAkB3U6f5xFrOgDdYbeOAbnAZO HNdWXUGhjpefAadWcrx0SersRyHKHyTsrFaVm2Tav/UNjWDWlmh0FlpEmNG49XtG/Z4D 1M53tCST9kT55lyTA/dSqQOp6mLK6UZGo08azDZwIkIZIrA9Mubl0IrSyE2Duw1UAXNS xgcnLlaGJjaM22m+XIq2Gb0eBtPcsVwKslH9obAbr8e4kChd3vQc3ifKaogJJfFDDdGY 7Rufxj9I4MF6KTG8HR9HdecrvTt0m/UOtA6h1MtfXitXFQNSXYMFcHQvY0OTyG1UNBkC f03A== X-Gm-Message-State: AOAM531KGO7xhv1LVxAuQflkFtJik/RuYiPVXgn8FAu37/zItFuKBcfK o6bpMVBWsmkypLO9FMr3oTKi6BsldfA= X-Google-Smtp-Source: ABdhPJyJ4vmdpoReMwk1sqx8N+a0Yn8sl5xuAQchzsRHA9FKIwvrv1Y5q8Q1mzwGQUw8ddMSetb9zQ== X-Received: by 2002:a05:600c:4f82:b0:38c:9185:1ecd with SMTP id n2-20020a05600c4f8200b0038c91851ecdmr1127121wmq.130.1647903379961; Mon, 21 Mar 2022 15:56:19 -0700 (PDT) Received: from fedora35.example.com ([151.24.239.1]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm10022910wrq.44.2022.03.21.15.56.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:19 -0700 (PDT) From: Elia Pinto To: git@vger.kernel.org Cc: Elia Pinto Subject: [PATCH 41/41] exit.cocci: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Date: Mon, 21 Mar 2022 22:55:23 +0000 Message-Id: <20220321225523.724509-42-gitter.spiros@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321225523.724509-1-gitter.spiros@gmail.com> References: <20220321225523.724509-1-gitter.spiros@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed to exit() to indicate successful or unsuccessful termination, respectively. The value of status in exit(status) may be EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits (that is, status & 0377) shall be available to a waiting parent proces. So exit(-1) return 255. Add a coccinelle semantic patch for using the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit status instead of "0" or "1", respectively. In EXIT_FAILURE has the value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for consistency. Signed-off-by: Elia Pinto --- contrib/coccinelle/exit.cocci | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 contrib/coccinelle/exit.cocci diff --git a/contrib/coccinelle/exit.cocci b/contrib/coccinelle/exit.cocci new file mode 100644 index 0000000000..ea5c243061 --- /dev/null +++ b/contrib/coccinelle/exit.cocci @@ -0,0 +1,24 @@ +@@ +@@ +- exit(0); ++ exit(EXIT_SUCCESS); +@@ +@@ +- _exit(0); ++ _exit(EXIT_SUCCESS); +@@ +@@ +- exit(1); ++ exit(EXIT_FAILURE); +@@ +@@ +- _exit(1); ++ _exit(EXIT_FAILURE); +@@ +@@ +- exit(-1); ++ exit(EXIT_FAILURE); +@@ +@@ +- _exit(-1); ++ _exit(EXIT_FAILURE);