Skip to content

Commit

Permalink
Reap child processes in shairport.c
Browse files Browse the repository at this point in the history
  • Loading branch information
James Laird committed Jan 8, 2012
1 parent 83c1b71 commit 6ce7675
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions shairport.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/

#include <fcntl.h>
#include <signal.h>
#include "socketlib.h"
#include "shairport.h"
#include "hairtunes.h"
Expand All @@ -51,8 +52,23 @@ extern int buffer_start_fill;
#define HEADER_LOG_LEVEL LOG_DEBUG
#define AVAHI_LOG_LEVEL LOG_DEBUG

void handle_sigchld(int signo) {
int status;
waitpid(-1, &status, WNOHANG);
}

int main(int argc, char **argv)
{
// unfortunately we can't just IGN on non-SysV systems
struct sigaction sa;
sa.sa_handler = handle_sigchld;
sa.sa_flags = 0;
sigemptyset(&sa.sa_mask);
if (sigaction(SIGCHLD, &sa, NULL) < 0) {
perror("sigaction");
return 1;
}

char tHWID[HWID_SIZE] = {0,51,52,53,54,55};
char tHWID_Hex[HWID_SIZE * 2 + 1];
memset(tHWID_Hex, 0, sizeof(tHWID_Hex));
Expand Down

0 comments on commit 6ce7675

Please sign in to comment.