Fix resource leaks and minor issues

- Close pipe fds on fork failure in ExecFile::execute
- Add exception-safe fclose in cmd_file_append via try/catch
- Add overflow guards before K/M/G bit shifts in parse_whole_value
- Fix %u format for int* in sscanf (change to %d)
- Fix typo "atter"→"after" in error message
This commit is contained in:
sirus20x6
2026-03-13 20:28:38 -05:00
committed by Jari Sundell
parent 6f27159627
commit 0aaa470053
5 changed files with 24 additions and 9 deletions
+1 -1
View File
@@ -137,7 +137,7 @@ void
OptionParser::call_int_pair(slot_int_pair slot, const std::string& arg) {
int a, b;
if (std::sscanf(arg.c_str(), "%u-%u", &a, &b) != 2)
if (std::sscanf(arg.c_str(), "%d-%d", &a, &b) != 2)
throw std::runtime_error("Invalid argument, \"" + arg + "\" should be \"a-b\"");
slot(a, b);