From patchwork Thu Sep 6 11:40:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 966925 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=209.85.167.56; helo=mail-lf1-f56.google.com; envelope-from=swupdate+bncbcxploxj6ikrbqfeytoakgqetdy72ui@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="grTT2U5o"; dkim-atps=neutral Received: from mail-lf1-f56.google.com (mail-lf1-f56.google.com [209.85.167.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 425dtY14Flz9s4Z for ; Thu, 6 Sep 2018 21:40:52 +1000 (AEST) Received: by mail-lf1-f56.google.com with SMTP id m99-v6sf1985082lfi.6 for ; Thu, 06 Sep 2018 04:40:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1536234049; cv=pass; d=google.com; s=arc-20160816; b=TS80M541IWpRtioulrSx7ED67pmbHPyHA4sErzBSCQWnBUOEJ+11wN3iNglYo7m7qb E6AfOm6cHMJeQ91ibuDI8FfhC17bqnfXwHJ/6fLsO376t4Q6YpY151PopQoR3eap2Z5/ nHEIIIu7bXcNmr4aV5u1cuvk+LgD0bvuN4yo7qmH5cd5ilLYexuxv1FsvPumFK0nqdBt vqAXt4rOCvfNXF+bdd5999beM8IzznMFzxJxZ2eC+eksmPuncMAaqRrYpAHkuxspVqIx GlsXcMBdzA9z3r8M5+xw2JRN0bjKHWLD9bcfSSx6uB9tjSvmMcH8XMhlhTf8EHmg763e V+Kw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:message-id:date:subject:cc:to:from :mime-version:sender:dkim-signature; bh=u+riTWTriVBzd3Oz3gxWqbI3Eqk5lOH3gR0+dJKTc30=; b=oT3CJ849dyPR5etAEghMgj/NGduhe16N/021KFMDV+F3nbaVvUl7QE6F/LmH0GY8Wr 9n2L2nzbSPnIBh3Bva0XBbNDPyt7zN5l4tz/f3WDN3DhU2Q5t6PsKpurAnmaSrJi0R9K Qat03u1ow8m+ivnc1bzxK3e9HBTCltGLnBeRsqQrXIkQARf/3CRBEQKHHqSbR+j/WpEo lFVJJp2+qIIiE/fznxdvBEyZyWMI8JjdPqCKDx6MCSb9phK+2bb4pYMScGpjA0LO//fr GGIKwjKIv+DVX5U41t2kznnAKCs/JtkKiCHuPWPzDXHfjr582NsAruEIQGm9ETXHNdUM 5viw== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=u+riTWTriVBzd3Oz3gxWqbI3Eqk5lOH3gR0+dJKTc30=; b=grTT2U5oZVoGAlUcVVMpHWEI5lFgDaq08veBeRgln8BvdatFUlYN40cwU9SR4XAbcf fqix3T8HpLF3NoJWNlRhvDM3Q62VU6AaikoqoqMapvite+CbNJhRqZpyS9q+dqFVRSjp mIg7pdlYo1I17hTcwx2uyWfQSbGopWy0HJ+/oWtiGd49L/2W8T4kwJedUiceFc+ETauJ gA80Q+E8xI/j3LNwnwHdSKjKX6OVwBZoy8jIZGYeBH72p9iR8hVxYDwW4ZvJ2l4T9XNj YdG8I9nFEBkdW8kCfKUtbYCe2+Jwcjt6UnLcq6AIOZSW4FCvXtKc1ZHgRCTe1zdpv4Gl IMFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=u+riTWTriVBzd3Oz3gxWqbI3Eqk5lOH3gR0+dJKTc30=; b=EkeLDl+L/mFgQ6WHTlmxxQw2XWm1qwiLlNda/Vvz0cu22cFui+Dea9X4kK3B2O5MTR pbPhSAggucGrSDVfVKN0sYQWQTttn+BukA1oLnuBo+XTBq97zfVDOqwWwi4OU+geAPhR pvifsWDyYtFgSHpq0MMLg59Awgbnw3wIuzfNKzMKdzf016jvqGoTs10vnbGoakAqv29g Yklt9FnVPxQpeXjB+5GMatPSeYt3TwjDz1ykpXVCrus1DsKyM5jEkxWFhH1psLeg+eJU VddW3/y/t/mu11z9xc5bNzOkqDGeOag1A5kgbAI10fOVgKpe51oOGOzuIMunU7Y6o4O3 uIgA== Sender: swupdate@googlegroups.com X-Gm-Message-State: APzg51DuUndKty2029HaVV+6jyvqJwkGr0m/CrLYRkqQNL+P5qq+IFtE ghzn3DjZ0/mL5Tm56oob+lc= X-Google-Smtp-Source: ANB0VdZPChVyNSKQDdnABsvDdLY6p3b1xgBbyeMF3oWgS4SIQddWR0kYqWJOSFKID/6cTYCNrC7ytA== X-Received: by 2002:a2e:8699:: with SMTP id l25-v6mr15508lji.0.1536234048795; Thu, 06 Sep 2018 04:40:48 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a2e:9d4:: with SMTP id 203-v6ls509899ljj.5.gmail; Thu, 06 Sep 2018 04:40:48 -0700 (PDT) X-Received: by 2002:a2e:42ce:: with SMTP id h75-v6mr53644ljf.22.1536234048298; Thu, 06 Sep 2018 04:40:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536234048; cv=none; d=google.com; s=arc-20160816; b=lVtTlezwrNPJK+8BueZ/PKUspQ9NqN3CGHJfw3l1XSDT+/MFMbEjQxq0m5oD8Y6+Yt Dmjd/AlBmSIbj1yQV7/b+QwzoubKMvdY+XtNNmV2Kqe01Bpn9lQjz5EjnByLQkcrV3My SClw2elAIjuB4dS19SdOe7eHXojb6PnrFtgfbutkgVd4F2pVs0x8Lcz29i0lhLVSQuUr pPcGIMKlOfckwy6txsf/IsbawgmvWppkWP0VbWiOQnGoiT+gjcD7rmO3mvNA3cHVyod+ T+kQvtgNF6sg0L8GmkFywIvQezksr4zO74UEkwWjlj8aWComx2R+VePnb/SupKK6S8kh exYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=H65adklwk1+0DfcGZZkwPGVC7pxKr71u4+2tJ3xA+cg=; b=nlAg/Vo3sVjtsqwyO3IB0kg2zqCAIJE2Q/Qv4NPwM68ElhFzazLXy+YmG4QVj2u7nL 8mK6eDpX1WO4uccLs+yg0+PIjAQPfJzFfekIfZu6DkoprMJNtV9kfQXLdnCeipmSzzHy uXgl54WsbUkYf8H6d9HRPN+ZbCz0MmyAuhLuL3U8CnrkX4LVVPhDB7ILGqehndRqvqnN CILV5yqgyfUrYQM5HLZJD7DZr9Q15O+pGZmwG/jV0C2GgK0eJEIml0M+PjZVHLz69/3f b7BqJvCJmajrBexvmYiUd9pyFJ/pp0YdpjQ566kfGnCkLRen6laNs+pxF+QxPbzAMuR6 UYdg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.10]) by gmr-mx.google.com with ESMTPS id v16-v6si118561ljg.3.2018.09.06.04.40.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 04:40:48 -0700 (PDT) Received-SPF: neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.10; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 425dtR4Wf3z1qvnY; Thu, 6 Sep 2018 13:40:47 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 425dtR4JQrz1qrVm; Thu, 6 Sep 2018 13:40:47 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id DiZWOZGSzam5; Thu, 6 Sep 2018 13:40:46 +0200 (CEST) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Thu, 6 Sep 2018 13:40:46 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id DABA04540571; Thu, 6 Sep 2018 13:40:45 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WdjPaJmlsYhy; Thu, 6 Sep 2018 13:40:43 +0200 (CEST) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 50E23454035B; Thu, 6 Sep 2018 13:40:43 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 1/9] Use provided macro for exit() Date: Thu, 6 Sep 2018 13:40:33 +0200 Message-Id: <20180906114041.21828-1-sbabic@denx.de> X-Mailer: git-send-email 2.17.1 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Use EXIT_FAILURE and EXIT_SUCCESS instead of the corresponding integer value. Signed-off-by: Stefano Babic --- core/swupdate.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/core/swupdate.c b/core/swupdate.c index 4a32e47..c456c2b 100644 --- a/core/swupdate.c +++ b/core/swupdate.c @@ -287,7 +287,7 @@ static int install_from_file(char *fname, int check) if (!strlen(fname)) { ERROR("Image not found...please reboot\n"); - exit(1); + exit(EXIT_FAILURE); } fdsw = open(fname, O_RDONLY); @@ -295,7 +295,7 @@ static int install_from_file(char *fname, int check) fdsw = searching_for_image(fname); if (fdsw < 0) { ERROR("Image Software cannot be read...exiting !\n"); - exit(1); + exit(EXIT_FAILURE); } } @@ -310,7 +310,7 @@ static int install_from_file(char *fname, int check) */ if (ret) { ERROR("Failed to extract meta information"); - exit(1); + exit(EXIT_FAILURE); } char* swdescfilename = alloca(strlen(get_tmpdir())+strlen(SW_DESCRIPTION_FILENAME)+1); @@ -318,19 +318,19 @@ static int install_from_file(char *fname, int check) ret = parse(&swcfg, swdescfilename); if (ret) { ERROR("failed to parse " SW_DESCRIPTION_FILENAME "!\n"); - exit(1); + exit(EXIT_FAILURE); } if (check_hw_compatibility(&swcfg)) { ERROR("SW not compatible with hardware\n"); - exit(1); + exit(EXIT_FAILURE); } if (cpio_scan(fdsw, &swcfg, pos) < 0) { ERROR("failed to scan for pos '%ld'!", pos); close(fdsw); - exit(1); + exit(EXIT_FAILURE); } /* @@ -340,17 +340,17 @@ static int install_from_file(char *fname, int check) ret = check_provided(&swcfg.images); if (ret) { ERROR("failed to check images!\n"); - exit(1); + exit(EXIT_FAILURE); } ret = check_provided(&swcfg.scripts); if (ret) { ERROR("failed to check scripts!\n"); - exit(1); + exit(EXIT_FAILURE); } if (check) { fprintf(stdout, "successfully checked '%s'\n", fname); - exit(0); + exit(EXIT_SUCCESS); } #ifdef CONFIG_MTD @@ -615,7 +615,7 @@ int main(int argc, char **argv) read_globals_settings, &swcfg)) { fprintf(stderr, "Error parsing configuration file, exiting..\n"); - exit(1); + exit(EXIT_FAILURE); } loglevel = swcfg.globals.loglevel; @@ -631,12 +631,12 @@ int main(int argc, char **argv) if (ret == -EINVAL) { fprintf(stderr, "Error parsing configuration file, exiting..\n"); - exit(1); + exit(EXIT_FAILURE); } break; case '0': printf("%s", BANNER); - exit(0); + exit(EXIT_SUCCESS); } } @@ -714,7 +714,7 @@ int main(int argc, char **argv) break; case 'h': usage(argv[0]); - exit(0); + exit(EXIT_SUCCESS); break; #ifdef CONFIG_DOWNLOAD case 'd': @@ -725,7 +725,7 @@ int main(int argc, char **argv) #endif case 'H': if (opt_to_hwrev(optarg, &swcfg.hw) < 0) - exit(1); + exit(EXIT_FAILURE); break; #ifdef CONFIG_SURICATTA case 'u': @@ -750,7 +750,7 @@ int main(int argc, char **argv) break; default: usage(argv[0]); - exit(1); + exit(EXIT_FAILURE); break; } } @@ -758,7 +758,7 @@ int main(int argc, char **argv) if (optind < argc) { /* SWUpdate has no non-option arguments, fail on them */ usage(argv[0]); - exit(1); + exit(EXIT_FAILURE); } /* @@ -769,27 +769,27 @@ int main(int argc, char **argv) fprintf(stderr, "swupdate built for signed image, provide a public key file\n"); usage(argv[0]); - exit(1); + exit(EXIT_FAILURE); } if (opt_c && !opt_i) { fprintf(stderr, "request check for local image, it requires -i\n"); usage(argv[0]); - exit(1); + exit(EXIT_FAILURE); } if (opt_i && strlen(swcfg.output)) { fprintf(stderr, "Output just from network - do you know cp ?\n"); usage(argv[0]); - exit(1); + exit(EXIT_FAILURE); } #ifdef CONFIG_SURICATTA if (opt_u && (opt_c || opt_i)) { fprintf(stderr, "invalid mode combination with suricatta.\n"); - exit(1); + exit(EXIT_FAILURE); } #endif @@ -799,7 +799,7 @@ int main(int argc, char **argv) if (swupdate_dgst_init(&swcfg, swcfg.globals.publickeyfname)) { fprintf(stderr, "Crypto cannot be initialized\n"); - exit(1); + exit(EXIT_FAILURE); } } @@ -876,7 +876,7 @@ int main(int argc, char **argv) if (load_decryption_key(swcfg.globals.aeskeyfname)) { fprintf(stderr, "Key file does not contain a valid AES key\n"); - exit(1); + exit(EXIT_FAILURE); } } @@ -895,7 +895,7 @@ int main(int argc, char **argv) if (opt_e) { if (parse_image_selector(software_select, &swcfg)) { fprintf(stderr, "Incorrect select option format\n"); - exit(1); + exit(EXIT_FAILURE); } fprintf(stderr, "software set: %s mode: %s\n", swcfg.software_set, swcfg.running_mode);