[PATCH] fix error in errno usage in util_create_path()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

well, I guess this patch is pretty much self-explanatory - untested as
usual ...

Florian

diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c
index 557df1b..3baa5f9 100644
--- a/libudev/libudev-util-private.c
+++ b/libudev/libudev-util-private.c
@@ -53,13 +53,13 @@ int util_create_path(struct udev *udev, const char *path)
 	dbg(udev, "mkdir '%s'\n", p);
 	udev_selinux_setfscreatecon(udev, p, S_IFDIR|0755);
 	ret = mkdir(p, 0755);
+	if (ret && errno == EEXIST)
+		if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR)
+			ret=0;
 	udev_selinux_resetfscreatecon(udev);
 	if (ret == 0)
 		return 0;
 
-	if (errno == EEXIST)
-		if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR)
-			return 0;
 	return -1;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux