Compare commits
3 Commits
69f3e28f2c
...
e2ff0ad273
Author | SHA1 | Date | |
---|---|---|---|
e2ff0ad273 | |||
62cb53069c | |||
fe302f5967 |
@ -56,7 +56,7 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Flush a stream's buffers. */
|
/* Flush a stream's buffers. */
|
||||||
int fflush(FILE*);
|
int fflush(FILE* stream);
|
||||||
|
|
||||||
/* Open a file and bind a stream to it. */
|
/* Open a file and bind a stream to it. */
|
||||||
FILE* fopen(const char* path, const char* mode);
|
FILE* fopen(const char* path, const char* mode);
|
||||||
@ -67,7 +67,7 @@ extern "C"
|
|||||||
/* Change the underlying file and mode of a stream. */
|
/* Change the underlying file and mode of a stream. */
|
||||||
FILE* freopen(const char* path, const char* mode, FILE* stream);
|
FILE* freopen(const char* path, const char* mode, FILE* stream);
|
||||||
|
|
||||||
/* Close a file and frees up its stream. */
|
/* Close a file and free up its stream. */
|
||||||
int fclose(FILE* stream);
|
int fclose(FILE* stream);
|
||||||
|
|
||||||
/* Return the file descriptor associated with a stream. */
|
/* Return the file descriptor associated with a stream. */
|
||||||
|
@ -16,7 +16,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
struct spwd* result;
|
struct spwd* result;
|
||||||
|
|
||||||
getspent_r(&spwd, s_buf, sizeof(s_buf), &result);
|
if (getspent_r(&spwd, s_buf, sizeof(s_buf), &result) < 0) return nullptr;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -28,7 +28,7 @@ extern "C"
|
|||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
f = fopen("/etc/shadow", "r");
|
f = fopen("/etc/shadow", "r");
|
||||||
if (!f) return 0;
|
if (!f) return -1;
|
||||||
fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
|
fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -793,11 +793,13 @@ extern "C"
|
|||||||
{
|
{
|
||||||
close(pfds[0]);
|
close(pfds[0]);
|
||||||
dup2(pfds[1], STDOUT_FILENO);
|
dup2(pfds[1], STDOUT_FILENO);
|
||||||
|
close(pfds[1]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
close(pfds[1]);
|
close(pfds[1]);
|
||||||
dup2(pfds[0], STDIN_FILENO);
|
dup2(pfds[0], STDIN_FILENO);
|
||||||
|
close(pfds[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
execl("/bin/sh", "sh", "-c", command, nullptr);
|
execl("/bin/sh", "sh", "-c", command, nullptr);
|
||||||
|
Loading…
Reference in New Issue
Block a user