From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9318 invoked by alias); 1 Mar 2012 21:16:10 -0000 Received: (qmail 9293 invoked by uid 9737); 1 Mar 2012 21:16:05 -0000 Date: Thu, 01 Mar 2012 21:16:00 -0000 Message-ID: <20120301211605.9291.qmail@sourceware.org> From: zkabelac@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2/lib/commands toolcontext.c Mailing-List: contact lvm2-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: lvm2-cvs-owner@sourceware.org X-SW-Source: 2012-03/txt/msg00016.txt.bz2 CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2012-03-01 21:16:05 Modified files: lib/commands : toolcontext.c Log message: Check for udev_get_dev_dir result Don't use NULL return value. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.152&r2=1.153 --- LVM2/lib/commands/toolcontext.c 2012/02/27 10:05:35 1.152 +++ LVM2/lib/commands/toolcontext.c 2012/03/01 21:16:05 1.153 @@ -664,8 +664,9 @@ if ((device_list_from_udev = udev_is_running() ? find_config_tree_bool(cmd, "devices/obtain_device_list_from_udev", DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV) : 0)) { - udev_dir = udev_get_dev_dir(); - udev_dir_len = strlen(udev_dir); + if (!(udev_dir = udev_get_dev_dir())) + stack; + udev_dir_len = (udev_dir) ? strlen(udev_dir) : 0; } init_obtain_device_list_from_udev(device_list_from_udev); @@ -687,7 +688,7 @@ return 0; } - if (device_list_from_udev) { + if (device_list_from_udev && udev_dir) { len = strlen(cv->v.str); len = udev_dir_len > len ? len : udev_dir_len; if (strncmp(udev_dir, cv->v.str, len) ||