Skip to content

Commit c544b9e

Browse files
N-R-Knavi-desu
authored andcommitted
rc-logger: use pipe2
1 parent 24a17ea commit c544b9e

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/openrc/rc-logger.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ rc_logger_open(const char *level)
155155
struct pollfd fd[2];
156156
int s = 0;
157157
size_t bytes;
158-
int i;
159158
FILE *log = NULL;
160159
FILE *plog = NULL;
161160
const char *logfile;
@@ -165,12 +164,8 @@ rc_logger_open(const char *level)
165164
if (!rc_conf_yesno("rc_logger"))
166165
return;
167166

168-
if (pipe(signal_pipe) == -1)
169-
eerrorx("pipe: %s", strerror(errno));
170-
for (i = 0; i < 2; i++)
171-
if ((s = fcntl (signal_pipe[i], F_GETFD, 0) == -1 ||
172-
fcntl (signal_pipe[i], F_SETFD, s | FD_CLOEXEC) == -1))
173-
eerrorx("fcntl: %s", strerror (errno));
167+
if (pipe2(signal_pipe, O_CLOEXEC) == -1)
168+
eerrorx("pipe2: %s", strerror(errno));
174169

175170
if (isatty(STDOUT_FILENO)) {
176171
tcgetattr(STDOUT_FILENO, &tt);

0 commit comments

Comments
 (0)