asalamon74 / pktriggercord

Remote control for Pentax DSLR cameras
http://pktriggercord.melda.info
GNU Lesser General Public License v3.0
103 stars 38 forks source link

Ignore "loop" devices in get_drives. #43

Closed karlrees closed 4 years ago

karlrees commented 4 years ago

This avoids a problem I was having on UbuntuMate 18.0.4 (installed on a Pi3) where a "loop" device existed for each snap package (e.g. loop0, loop1, etc.). There were 2500+ "loop" devices, which filled up the tmp array in get_drives way beyond MAX_DEVICE_NUM, and caused a "stack smashing" error.

I could be wrong, but I don't think the cameras would ever have a name that starts with "loop", so I think this should be a valid solution.

Another option might be to raise MAX_DEVICE_NUM to 10000+, which is probably pretty safe (this was a fresh install of UbuntuMate, so I don't know how many snap packages would be installed in the long run).

asalamon74 commented 4 years ago

I agree, we can ignore the "loop*" devices, I don't think a real device will use this name.

Thanks for the patch, committed.