All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 8/9] Adapt _rename_dev_node for udev
@ 2009-05-25 12:19 Peter Rajnoha
  0 siblings, 0 replies; only message in thread
From: Peter Rajnoha @ 2009-05-25 12:19 UTC (permalink / raw)
  To: lvm-devel

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) {



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-05-25 12:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-25 12:19 [PATCH 8/9] Adapt _rename_dev_node for udev Peter Rajnoha

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.