From: Zdenek Kabelac Date: Mon, 25 Oct 2010 12:08:15 +0000 (+0000) Subject: Reuse result of previous strchr X-Git-Tag: old-v2_02_75~13 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=b68cb6026ec647b95a49f56f65c52446b88be1a2;p=lvm2.git Reuse result of previous strchr Reported by clang as: Argument with 'nonnull' attribute passed null Reuse the result of the last strchr() call - make sure, 'st' point is not null for the next strchr() call. --- diff --git a/tools/toollib.c b/tools/toollib.c index 02c496248..5adc160c0 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -869,7 +869,7 @@ const char *extract_vgname(struct cmd_context *cmd, const char *lv_name) while (*st == '/') st++; - if (!strchr(vg_name, '/') || strchr(st, '/')) { + if (!st || strchr(st, '/')) { log_error("\"%s\": Invalid path for Logical Volume", lv_name); return 0;