0
0
mirror of https://github.com/rkd77/elinks.git synced 2025-06-30 22:19:29 -04:00

[osdep] initialize ret

This commit is contained in:
Witold Filipczyk 2023-11-16 19:09:49 +01:00
parent dabfe8dbbd
commit aa7edfc16d

View File

@ -352,17 +352,17 @@ exe(char *path)
int int
exe_no_stdin(char *path) { exe_no_stdin(char *path) {
int ret; int ret = 0;
#ifndef WIN32 #ifndef WIN32
#if defined(F_GETFD) && defined(FD_CLOEXEC) #if defined(F_GETFD) && defined(FD_CLOEXEC)
int flags; int flags;
flags = fcntl(STDIN_FILENO, F_GETFD); flags = fcntl(STDIN_FILENO, F_GETFD);
fcntl(STDIN_FILENO, F_SETFD, flags | FD_CLOEXEC); fcntl(STDIN_FILENO, F_SETFD, flags | FD_CLOEXEC);
ret = exe(path); ret = exe(path);
fcntl(STDIN_FILENO, F_SETFD, flags); fcntl(STDIN_FILENO, F_SETFD, flags);
#else #else
pid_t pid; pid_t pid;
pid = fork(); pid = fork();
@ -372,7 +372,8 @@ exe_no_stdin(char *path) {
} }
else if (pid > 0) else if (pid > 0)
waitpid(pid, &ret, 0); waitpid(pid, &ret, 0);
#endif #endif
#endif #endif
return ret; return ret;
} }