xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit dbb86283134fe4ecadc726a3f49db0adb27ff3ca

Improve closing of error pipe in launch_external()
It wasn't closed on failure to start the command and all other places
were missing check for INVALID_HANDLE_VALUE which is necessary because
error stream might not be redirected. This is Windows-specific.
Author: xaizek
Author date (UTC): 2024-03-05 09:52
Committer name: xaizek
Committer date (UTC): 2024-03-11 17:30
Parent(s): a1c5d350a5971216a3fb57d6fd10f29f0aa510c4
Signing key: 99DC5E4DB05F6BE2
Tree: f5e67cc8df39acc56521156409aed13b05c68aee
File Lines added Lines deleted
src/background.c 16 3
File src/background.c changed (mode: 100644) (index 3d31f7700..7ba30d8ef)
... ... launch_external(const char cmd[], BgJobFlags flags, ShellRequester by)
1151 1151 HANDLE hin = INVALID_HANDLE_VALUE; HANDLE hin = INVALID_HANDLE_VALUE;
1152 1152 if(supply_input && !CreatePipe(&startup.hStdInput, &hin, NULL, 16*1024)) if(supply_input && !CreatePipe(&startup.hStdInput, &hin, NULL, 16*1024))
1153 1153 { {
1154 CloseHandle(herr);
1154 if(herr != INVALID_HANDLE_VALUE)
1155 {
1156 CloseHandle(herr);
1157 }
1155 1158 CloseHandle(hnul); CloseHandle(hnul);
1156 1159 return NULL; return NULL;
1157 1160 } }
 
... ... launch_external(const char cmd[], BgJobFlags flags, ShellRequester by)
1161 1164 { {
1162 1165 if(!CreatePipe(&hout, &startup.hStdOutput, NULL, 16*1024)) if(!CreatePipe(&hout, &startup.hStdOutput, NULL, 16*1024))
1163 1166 { {
1164 CloseHandle(herr);
1167 if(herr != INVALID_HANDLE_VALUE)
1168 {
1169 CloseHandle(herr);
1170 }
1165 1171 CloseHandle(hin); CloseHandle(hin);
1166 1172 CloseHandle(hnul); CloseHandle(hnul);
1167 1173 return NULL; return NULL;
 
... ... launch_external(const char cmd[], BgJobFlags flags, ShellRequester by)
1194 1200 if(!started) if(!started)
1195 1201 { {
1196 1202 free(sh_cmd); free(sh_cmd);
1203 if(herr != INVALID_HANDLE_VALUE)
1204 {
1205 CloseHandle(herr);
1206 }
1197 1207 CloseHandle(hout); CloseHandle(hout);
1198 1208 CloseHandle(hin); CloseHandle(hin);
1199 1209 return NULL; return NULL;
 
... ... launch_external(const char cmd[], BgJobFlags flags, ShellRequester by)
1211 1221
1212 1222 if(job == NULL) if(job == NULL)
1213 1223 { {
1214 CloseHandle(herr);
1224 if(herr != INVALID_HANDLE_VALUE)
1225 {
1226 CloseHandle(herr);
1227 }
1215 1228 CloseHandle(hin); CloseHandle(hin);
1216 1229 CloseHandle(hout); CloseHandle(hout);
1217 1230 CloseHandle(pinfo.hProcess); CloseHandle(pinfo.hProcess);
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master