diff options
| author | Jo-Philipp Wich | 2019-03-27 07:59:02 +0000 |
|---|---|---|
| committer | Jo-Philipp Wich | 2019-03-31 14:09:40 +0000 |
| commit | 3957dd39c6c2413c4341258d63a913948f99ac6f (patch) | |
| tree | 93b1d28c08baca76eb71ae12a049f5650a3de250 | |
| parent | 9b36dc25dd31197681dfcbe4e83879a9b885f451 (diff) | |
| download | fstools-3957dd39c6c2413c4341258d63a913948f99ac6f.tar.gz | |
block: prevent mount point confusion
Do not perform substring matches when identifying mount points to
avoid returning wrong entries, e.g. "/dev/mmcblk0p10" when
"/dev/mmcblk0p1" was requested.
Fixes: FS#2196
Ref: https://bugs.openwrt.org/index.php?do=details&task_id=2196
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
| -rw-r--r-- | block.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -579,7 +579,6 @@ static char* find_mount_point(char *block) { FILE *fp = fopen("/proc/self/mountinfo", "r"); static char line[256]; - int len = strlen(block); char *point = NULL, *pos, *tmp, *cpoint, *devname; struct stat s; int rstat; @@ -643,7 +642,7 @@ static char* find_mount_point(char *block) *pos = '\0'; devname = tmp; - if (!strncmp(block, devname, len)) { + if (!strcmp(block, devname)) { point = strdup(cpoint); break; } |