Showing the changes to src/core/util_serial.cpp (1 of 2 files). Show all
Unified · Split
| @@ -126,9 +126,14 @@ using namespace std; · 125 unmodified lines | ||
| 126 | 126 | vector<string> SerialIOManager::availableSerialDevices() |
| 127 | 127 | { |
| 128 | 128 | vector<string> devices; |
| 129 | − const int buf_size = PATH_MAX; | |
| 129 | + const int buf_size = 4096; | |
| 130 | + // was PATH_MAX; | |
| 131 | + // which apparently isn't | |
| 132 | + // https://stackoverflow.com/questions/9449241/where-is-path-max-defined-in-linux | |
| 133 | + // https://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html | |
| 134 | + // https://news.ycombinator.com/item?id=14194681 | |
| 130 | 135 | const char * serial_dir = "/dev/serial/by-id"; |
| 131 | − char link_buf[buf_size]; | |
| 136 | + char link_buf[buf_size+256]; // 1.5.0.1 (ge) added 256 for extra snprintf padding | |
| 132 | 137 | char path_buf[buf_size]; |
| 133 | 138 | |
| 134 | 139 | DIR * dir = opendir(serial_dir); |