kopia lustrzana https://github.com/FreeSpacenav/spacenavd
fixed an off-by-one error introduced in the latest commit which broke the main
device detection routine and fell back unto the alternative device detection. git-svn-id: svn+ssh://svn.code.sf.net/p/spacenav/code/trunk/spacenavd@155 ef983eb1-d774-4af8-acfd-baaf7b16a646pull/1/head
rodzic
b318c18c02
commit
c17defa830
|
@ -205,7 +205,7 @@ void find_usb_devices(char **path, int str_n, int char_n)
|
|||
buf_pos = buf;
|
||||
buf_len = sizeof(buf);
|
||||
if((fp = fopen(PROC_DEV, "r"))) {
|
||||
while(fread(buf_pos, sizeof(char), buf_len, fp)) {
|
||||
while(fread(buf_pos, 1, buf_len, fp) > 0) {
|
||||
section_start = buf;
|
||||
|
||||
for(;;) {
|
||||
|
@ -215,15 +215,15 @@ void find_usb_devices(char **path, int str_n, int char_n)
|
|||
buf_used = (buf + sizeof(buf)) - section_start;
|
||||
memmove(buf, section_start, buf_used);
|
||||
/* point to end of last section and calc remaining space in buf */
|
||||
buf_pos = buf + buf_used + 1;
|
||||
buf_pos = buf + buf_used;
|
||||
buf_len = sizeof(buf) - buf_used;
|
||||
/* break to read from file again */
|
||||
break;
|
||||
}
|
||||
/* set second newline to teminating null */
|
||||
*(next_section + sizeof(char)) = 0;
|
||||
next_section[1] = 0;
|
||||
/* point to start of next section */
|
||||
next_section += 2 * sizeof(char);
|
||||
next_section += 2;
|
||||
|
||||
valid_vendor = 0;
|
||||
valid_str = 0;
|
||||
|
|
Ładowanie…
Reference in New Issue