i3bar: check exit code of pipe()

This commit is contained in:
Michael Stapelberg 2011-10-23 14:31:43 +01:00
parent 5ec5a07dd2
commit 96f67a53a5
1 changed files with 4 additions and 1 deletions

View File

@ -19,6 +19,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <err.h>
#include <ev.h> #include <ev.h>
#include "common.h" #include "common.h"
@ -131,7 +132,9 @@ void start_child(char *command) {
child_pid = 0; child_pid = 0;
if (command != NULL) { if (command != NULL) {
int fd[2]; int fd[2];
pipe(fd); if (pipe(fd) == -1)
err(EXIT_FAILURE, "pipe(fd)");
child_pid = fork(); child_pid = fork();
switch (child_pid) { switch (child_pid) {
case -1: case -1: