Hi, I'm not sure if you would like to change this.... In devices.c you scan for the device name in /proc/devices using the %as string. On bionic this doesn't seem to work and therefore no devices are found and because of this no ioctl group ever matches.
I changed the code the following way:
@@ -21,7 +22,8 @@ static size_t bldevs, chrdevs, miscdevs;
static void parse_proc_devices(void)
{
FILE *fp;
- char *name, *line = NULL;
+ char *line = NULL;
+ char name[32];
size_t n = 0;
int block, major;
void *new;
@@ -33,30 +35,31 @@ static void parse_proc_devices(void)
block = 0;
while (getline(&line, &n, fp) >= 0) {
+ memset(name, 0, sizeof(name));
if (strcmp("Block devices:\n", line) == 0)
block = 1;
- else if (sscanf(line, "%d %as", &major, &name) == 2) {
+ else if (strcmp("Character devices:\n", line) == 0)
+ block = 0;
+ else if (sscanf(line, "%d %s", &major, &name) == 2) {
if (block) {
new = realloc(block_devs,
(bldevs+1)*sizeof(*block_devs));
if (!new) {
- free(name);
continue;
}
block_devs = new;
block_devs[bldevs].major = major;
block_devs[bldevs].minor = 0;
- block_devs[bldevs].name = name;
+ block_devs[bldevs].name = strdup(name);
bldevs++;
} else {
new = realloc(char_devs,
(chrdevs+1)*sizeof(*char_devs));
if (!new) {
- free(name);
continue;
}
char_devs = new;
char_devs[chrdevs].major = major;
char_devs[chrdevs].minor = 0;
- char_devs[chrdevs].name = name;
+ char_devs[chrdevs].name = strdup(name);
chrdevs++;
}
}
I also added the additional strcmp just to make sure that the code works also
if the order of character devices/block devices in /proc/devices changes at
some point.
Cheers
Nico
pgpzjtFmnNRWm.pgp
Description: PGP signature
