public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: zkabelac@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2/lib/locking cluster_locking.c file_locking.c Date: Wed, 05 Jan 2011 15:10:00 -0000 [thread overview] Message-ID: <20110105151031.14688.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-01-05 15:10:30 Modified files: lib/locking : cluster_locking.c file_locking.c Log message: Check result of dm_snprintf for error Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/cluster_locking.c.diff?cvsroot=lvm2&r1=1.47&r2=1.48 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/file_locking.c.diff?cvsroot=lvm2&r1=1.51&r2=1.52 --- LVM2/lib/locking/cluster_locking.c 2010/11/29 11:13:12 1.47 +++ LVM2/lib/locking/cluster_locking.c 2011/01/05 15:10:30 1.48 @@ -409,12 +409,14 @@ } /* If the VG name is empty then lock the unused PVs */ - if (is_orphan_vg(resource) || is_global_vg(resource) || (flags & LCK_CACHE)) - dm_snprintf(lockname, sizeof(lockname), "P_%s", - resource); - else - dm_snprintf(lockname, sizeof(lockname), "V_%s", - resource); + if (dm_snprintf(lockname, sizeof(lockname), "%c_%s", + (is_orphan_vg(resource) || + is_global_vg(resource) || + (flags & LCK_CACHE)) ? 'P' : 'V', + resource) < 0) { + log_error("Locking resource %s too long.", resource); + return 0; + } lock_scope = "VG"; clvmd_cmd = CLVMD_CMD_LOCK_VG; --- LVM2/lib/locking/file_locking.c 2010/12/13 10:43:57 1.51 +++ LVM2/lib/locking/file_locking.c 2011/01/05 15:10:30 1.52 @@ -268,12 +268,20 @@ if (flags & LCK_CACHE) break; - if (is_orphan_vg(resource) || is_global_vg(resource)) - dm_snprintf(lockfile, sizeof(lockfile), - "%s/P_%s", _lock_dir, resource + 1); - else - dm_snprintf(lockfile, sizeof(lockfile), - "%s/V_%s", _lock_dir, resource); + if (is_orphan_vg(resource) || is_global_vg(resource)) { + if (dm_snprintf(lockfile, sizeof(lockfile), + "%s/P_%s", _lock_dir, resource + 1) < 0) { + log_error("Too long locking filename %s/P_%s.", + _lock_dir, resource + 1); + return 0; + } + } else + if (dm_snprintf(lockfile, sizeof(lockfile), + "%s/V_%s", _lock_dir, resource) < 0) { + log_error("Too long locking filename %s/V_%s.", + _lock_dir, resource); + return 0; + } if (!_lock_file(lockfile, flags)) return_0;
reply other threads:[~2011-01-05 15:10 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=20110105151031.14688.qmail@sourceware.org \ --to=zkabelac@sourceware.org \ --cc=lvm-devel@redhat.com \ --cc=lvm2-cvs@sourceware.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).