All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Rajnoha <prajnoha@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH 8/9] Adapt _rename_dev_node for udev
Date: Mon, 25 May 2009 14:19:29 +0200	[thread overview]
Message-ID: <4A1A8CD1.6050607@redhat.com> (raw)

This one is for _rename_dev_node -- if udev renames the node, this
code won't overwrite it once again. Also, if udev has done the
rename already, the old node does not exist anymore, so we have to
detect this somehow.

Peter


diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index ef249dc..90dd031 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -350,6 +350,10 @@ static int _rename_dev_node(const char *old_name, const char *new_name)
 				  "is already present", newpath);
 			return 0;
 		}
+		else if (stat(oldpath, &info) < 0 &&
+			 errno == ENOENT)
+			/* udev should have done this already */
+			return 1;
 
 		if (unlink(newpath) < 0) {
 			if (errno == EPERM) {



                 reply	other threads:[~2009-05-25 12:19 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=4A1A8CD1.6050607@redhat.com \
    --to=prajnoha@redhat.com \
    --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.