]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - util.c
tests/06name: adjust for homehost
[thirdparty/mdadm.git] / util.c
diff --git a/util.c b/util.c
index f15ba43d44953974979b7f09c4ce9fa3c6a47fa2..1736d70791c8ce5d145f6c01516384f4c19adb30 100644 (file)
--- a/util.c
+++ b/util.c
@@ -828,6 +828,20 @@ int open_dev_excl(int devnum)
        return -1;
 }
 
+int same_dev(char *one, char *two)
+{
+       struct stat st1, st2;
+       if (stat(one, &st1) != 0)
+               return 0;
+       if (stat(two, &st2) != 0)
+               return 0;
+       if ((st1.st_mode & S_IFMT) != S_IFBLK)
+               return 0;
+       if ((st2.st_mode & S_IFMT) != S_IFBLK)
+               return 0;
+       return st1.st_rdev == st2.st_rdev;
+}
+
 struct superswitch *superlist[] = { &super0, &super1, &super_ddf, &super_imsm, NULL };
 
 #if !defined(MDASSEMBLE) || defined(MDASSEMBLE) && defined(MDASSEMBLE_AUTO)