find_overlay_mount(char *overlay)
{
FILE *fp = fopen("/proc/mounts", "r");
+ size_t len = strlen(overlay);
static char line[256];
int ret = -1;
return ret;
while (ret && fgets(line, sizeof(line), fp))
- if (!strncmp(line, overlay, strlen(overlay)))
+ if (len < sizeof(line) && !strncmp(line, overlay, len) && line[len] == ' ')
ret = 0;
fclose(fp);
{
FILE *fp = fopen("/proc/self/mountinfo", "r");
static char line[256];
- int len = strlen(block);
char *point = NULL, *pos, *tmp, *cpoint, *devname, *fstype;
struct stat s;
int rstat;
devname = tmp;
/* if device name matches */
- if (!strncmp(block, devname, len + 1)) {
+ if (!strcmp(block, devname)) {
if (root_only && fs_rootfs_only(fstype))
break;
return NULL;
}
- if (strncmp(name, volname, strlen(volname) + 1))
+ if (strcmp(name, volname))
return NULL;
p = calloc(1, sizeof(struct ubi_volume));