All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Rockai <mornfall@fedoraproject.org>
To: lvm-devel@redhat.com
Subject: dev-mornfall-activate - cleanup: improve previous patch
Date: Tue,  4 Jun 2013 19:25:58 +0000 (UTC)	[thread overview]
Message-ID: <20130604192558.039B66115D@fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=986a50e4a1c017cc655bbcce45ffa4444386678b
Commit:        986a50e4a1c017cc655bbcce45ffa4444386678b
Parent:        2d3700ba42e156aa8b6e2819736cab6866ea56ce
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Mon Apr 29 13:50:26 2013 +0200
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Fri May 3 15:44:14 2013 +0200

cleanup: improve previous patch

Make the test earlier, before any dereference of 'argv' pointer.
---
 tools/lvmcmdline.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 60aa4d9..c03e9ef 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1487,6 +1487,9 @@ int lvm2_main(int argc, char **argv)
 	int ret, alias = 0;
 	struct cmd_context *cmd;
 
+	if (!argv)
+		return -1;
+
 	base = last_path_component(argv[0]);
 	if (strcmp(base, "lvm") && strcmp(base, "lvm.static") &&
 	    strcmp(base, "initrd-lvm"))
@@ -1499,7 +1502,7 @@ int lvm2_main(int argc, char **argv)
 		return -1;
 
 	if (is_static() && strcmp(base, "lvm.static") &&
-	    path_exists(LVM_SHARED_PATH) && argv &&
+	    path_exists(LVM_SHARED_PATH) &&
 	    !getenv("LVM_DID_EXEC")) {
 		if (setenv("LVM_DID_EXEC", base, 1))
 			log_sys_error("setenv", "LVM_DID_EXEC");



                 reply	other threads:[~2013-06-04 19:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130604192558.039B66115D@fedorahosted.org \
    --to=mornfall@fedoraproject.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.