1512 struct stat64 st1, st2;
1513 nvlist_t *nvl1 = NULL;
1514 nvlist_t *nvl2 = NULL;
1515
1516 if ((getattrat(AT_FDCWD, XATTR_VIEW_READONLY, path1, &nvl1) == 0) &&
1517 (getattrat(AT_FDCWD, XATTR_VIEW_READONLY, path2, &nvl2) == 0) &&
1518 (nvlist_lookup_uint64(nvl1, A_FSID, &fsid1) == 0) &&
1519 (nvlist_lookup_uint64(nvl2, A_FSID, &fsid2) == 0)) {
1520 nvlist_free(nvl1);
1521 nvlist_free(nvl2);
1522 /*
1523 * We have found fsid's for both paths.
1524 */
1525
1526 if (fsid1 == fsid2)
1527 return (B_TRUE);
1528
1529 return (B_FALSE);
1530 }
1531
1532 if (nvl1 != NULL)
1533 nvlist_free(nvl1);
1534 if (nvl2 != NULL)
1535 nvlist_free(nvl2);
1536
1537 /*
1538 * We were unable to find fsid's for at least one of the paths.
1539 * fall back on st_dev.
1540 */
1541
1542 if (stat64(path1, &st1) < 0) {
1543 syslog(LOG_NOTICE, "%s: %m", path1);
1544 return (B_FALSE);
1545 }
1546 if (stat64(path2, &st2) < 0) {
1547 syslog(LOG_NOTICE, "%s: %m", path2);
1548 return (B_FALSE);
1549 }
1550
1551 if (st1.st_dev == st2.st_dev)
1552 return (B_TRUE);
1553
1554 return (B_FALSE);
|
1512 struct stat64 st1, st2;
1513 nvlist_t *nvl1 = NULL;
1514 nvlist_t *nvl2 = NULL;
1515
1516 if ((getattrat(AT_FDCWD, XATTR_VIEW_READONLY, path1, &nvl1) == 0) &&
1517 (getattrat(AT_FDCWD, XATTR_VIEW_READONLY, path2, &nvl2) == 0) &&
1518 (nvlist_lookup_uint64(nvl1, A_FSID, &fsid1) == 0) &&
1519 (nvlist_lookup_uint64(nvl2, A_FSID, &fsid2) == 0)) {
1520 nvlist_free(nvl1);
1521 nvlist_free(nvl2);
1522 /*
1523 * We have found fsid's for both paths.
1524 */
1525
1526 if (fsid1 == fsid2)
1527 return (B_TRUE);
1528
1529 return (B_FALSE);
1530 }
1531
1532 nvlist_free(nvl1);
1533 nvlist_free(nvl2);
1534
1535 /*
1536 * We were unable to find fsid's for at least one of the paths.
1537 * fall back on st_dev.
1538 */
1539
1540 if (stat64(path1, &st1) < 0) {
1541 syslog(LOG_NOTICE, "%s: %m", path1);
1542 return (B_FALSE);
1543 }
1544 if (stat64(path2, &st2) < 0) {
1545 syslog(LOG_NOTICE, "%s: %m", path2);
1546 return (B_FALSE);
1547 }
1548
1549 if (st1.st_dev == st2.st_dev)
1550 return (B_TRUE);
1551
1552 return (B_FALSE);
|