From 169daa11155988a210fac949297381743f3cb400 Mon Sep 17 00:00:00 2001 From: Kacper Date: Tue, 9 Dec 2025 23:14:53 +0100 Subject: feat: clang-tidy fixes --- lib/libc/stdio/popen.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'lib/libc/stdio/popen.c') diff --git a/lib/libc/stdio/popen.c b/lib/libc/stdio/popen.c index 09c931ad..1fd5f991 100644 --- a/lib/libc/stdio/popen.c +++ b/lib/libc/stdio/popen.c @@ -1,10 +1,10 @@ #include "stddef.h" // for NULL -#include // for EINVAL, errno -#include // for O_RDONLY, O_CLOEXEC, O_WRONLY -#include // for __IMPL -#include // for FILE, fclose, fdopen, popen -#include // for close, dup2, _exit, execl, fork, pipe2, STDIN_FI... +#include <__stdio.h> // for __FILE +#include // for EINVAL, errno +#include // for O_RDONLY, O_CLOEXEC, O_WRONLY +#include // for FILE, fclose, fdopen, popen +#include // for close, dup2, _exit, execl, fork, pipe2, STDIN_F... FILE *popen(const char *command, const char *mode) { @@ -41,7 +41,9 @@ FILE *popen(const char *command, const char *mode) close(pipefd[1]); fclose(stream); return NULL; - } else if (pid == 0) { + } + + if (pid == 0) { if (oflag == O_RDONLY) { dup2(pipefd[1], STDOUT_FILENO); close(pipefd[0]); @@ -51,7 +53,7 @@ FILE *popen(const char *command, const char *mode) close(pipefd[0]); close(pipefd[1]); } - execl("/bin/sh", "sh", "-c", command, (char *)NULL); + execl("/bin/sh", "sh", "-c", command, (char *)0); _exit(127); } else { if (oflag == O_RDONLY) { @@ -60,7 +62,7 @@ FILE *popen(const char *command, const char *mode) close(pipefd[0]); } - __IMPL(stream)->pid = pid; + __FILE(stream)->pid = pid; return stream; } -- cgit v1.2.3