Final code polish for consistency and correctness

- Use int32_t consistently in all loops
- Add zero-length check before memcpy
- Improve error detection in strtol (comment clarification)
- Ensure null terminator always has space reserved

Co-authored-by: squassina <8495707+squassina@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-02-18 09:04:20 +00:00
parent 969c68b66d
commit 1350b7787a
2 changed files with 8 additions and 4 deletions

View file

@ -865,7 +865,7 @@ int32_t spawn(const Arg *arg) {
// 4. execvp 失败时:清理并退出
// If execvp succeeds, this code never runs (process replaced)
// If it fails, clean up allocated strings before exiting
for (int i = 0; i < alloc_count; i++) {
for (int32_t i = 0; i < alloc_count; i++) {
free(allocated_strings[i]);
}
wlr_log(WLR_ERROR, "mango: execvp '%s' failed: %s\n", argv[0],