forked from Bananymous/banan-os
LibC: Fix popen to return correct return value instead of -1
This commit is contained in:
@@ -529,11 +529,8 @@ int pclose(FILE* file)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pid_t pid = file->pid;
|
|
||||||
(void)fclose(file);
|
|
||||||
|
|
||||||
int stat;
|
int stat;
|
||||||
while (waitpid(pid, &stat, 0) != -1)
|
while (waitpid(file->pid, &stat, 0) == -1)
|
||||||
{
|
{
|
||||||
if (errno != EINTR)
|
if (errno != EINTR)
|
||||||
{
|
{
|
||||||
@@ -541,6 +538,8 @@ int pclose(FILE* file)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(void)fclose(file);
|
||||||
return stat;
|
return stat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user