Re: [PATCH] Btrfs-progs: replace find_mount_root from send code

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

 



Hi Jan,

> +       mnttab = fopen("/etc/mtab", "r");

Isn't it better to use "/proc/mounts" here? Otherwise, if the FS was
mounted using "mount" syscall, then this code will fail to find the
correct mount root.

> +       while ((ent = getmntent(mnttab))) {
> +               len = strlen(ent->mnt_dir);
> +               if (strncmp(ent->mnt_dir, path, len) == 0) {
> +                       /* match found */
> +                       if (longest_matchlen < len) {
> +                               free(longest_match);
> +                               longest_matchlen = len;
> +                               longest_match = strdup(ent->mnt_dir);

Alex.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux