3 * check if a given path is a mountpoint
11 is_mountpoint(char *path)
13 /* Check if 'path' is a current mountpoint.
14 * Possibly we should also check it is the mountpoint of the
15 * filesystem holding the target directory, but there doesn't
16 * seem a lot of point.
18 * We deem it to be a mountpoint if appending a ".." gives a different
19 * device or the same inode number.
22 struct stat stb, pstb;
25 dotdot = xmalloc(strlen(path)+4);
27 strcat(strcpy(dotdot, path), "/..");
28 if (lstat(path, &stb) != 0 ||
29 lstat(dotdot, &pstb) != 0)
32 if (stb.st_dev != pstb.st_dev ||
33 stb.st_ino == pstb.st_ino)