wait3 -> waitpid

This commit is contained in:
vanhauser-thc 2022-07-18 10:04:01 +02:00
parent 770c5c436e
commit 615e566e79
2 changed files with 5 additions and 4 deletions

View file

@ -6,6 +6,7 @@ Release 9.4-dev
* Small fix for weird RTSP servers * Small fix for weird RTSP servers
* Added "2=" optional parameter to http-post-form module to tell hydra that * Added "2=" optional parameter to http-post-form module to tell hydra that
a "302" HTTP return code means success a "302" HTTP return code means success
* replaced wait3 with waitpid for better compatability
Release 9.3 Release 9.3

View file

@ -1026,7 +1026,7 @@ void killed_childs(int32_t signo) {
int32_t pid, i; int32_t pid, i;
killed++; killed++;
pid = wait3(NULL, WNOHANG, NULL); pid = waitpid(-1, NULL, WNOHANG);
for (i = 0; i < hydra_options.max_use; i++) { for (i = 0; i < hydra_options.max_use; i++) {
if (pid == hydra_heads[i]->pid) { if (pid == hydra_heads[i]->pid) {
hydra_heads[i]->pid = -1; hydra_heads[i]->pid = -1;
@ -1447,7 +1447,7 @@ void hydra_kill_head(int32_t head_no, int32_t killit, int32_t fail) {
// hydra_targets[hydra_heads[head_no]->target_no]->bfg_ptr[head_no] = // hydra_targets[hydra_heads[head_no]->target_no]->bfg_ptr[head_no] =
// NULL; // NULL;
} }
(void)wait3(NULL, WNOHANG, NULL); (void)waitpid(-1, NULL, WNOHANG);
} }
void hydra_increase_fail_count(int32_t target_no, int32_t head_no) { void hydra_increase_fail_count(int32_t target_no, int32_t head_no) {
@ -4251,7 +4251,7 @@ int main(int argc, char *argv[]) {
// hydra_brains.sent); // hydra_brains.sent);
usleepn(USLEEP_LOOP); usleepn(USLEEP_LOOP);
(void)wait3(NULL, WNOHANG, NULL); (void)waitpid(-1, NULL, WNOHANG);
// write restore file and report status // write restore file and report status
if (process_restore == 1 && time(NULL) - elapsed_restore > 299) { if (process_restore == 1 && time(NULL) - elapsed_restore > 299) {
hydra_restore_write(0); hydra_restore_write(0);
@ -4354,7 +4354,7 @@ int main(int argc, char *argv[]) {
for (i = 0; i < hydra_options.max_use; i++) for (i = 0; i < hydra_options.max_use; i++)
if (hydra_heads[i]->active == HEAD_ACTIVE && hydra_heads[i]->pid > 0) if (hydra_heads[i]->active == HEAD_ACTIVE && hydra_heads[i]->pid > 0)
hydra_kill_head(i, 1, 3); hydra_kill_head(i, 1, 3);
(void)wait3(NULL, WNOHANG, NULL); (void)waitpid(-1, NULL, WNOHANG);
#define STRMAX (10 * 1024) #define STRMAX (10 * 1024)
char json_error[STRMAX + 2], tmp_str[STRMAX + 2]; char json_error[STRMAX + 2], tmp_str[STRMAX + 2];