Applied daemon patch, thanks to Rune Magnussen

This commit is contained in:
Bill Cox
2015-08-18 09:44:00 -07:00
parent dbc4dd0db9
commit d785240e80
7 changed files with 116 additions and 3 deletions

21
software/daemon.c Normal file
View File

@@ -0,0 +1,21 @@
/* Functions used when running in the background
*/
#include <stdio.h>
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include "infnoise.h"
int writePid(pid_t pid, char *fileName) {
FILE *pidFile;
int ret;
pidFile = fopen(fileName,"w");
if(pidFile == NULL)
return errno;
ret = fprintf(pidFile, "%d\n", pid);
if (ret < 0)
return ret;
return fclose(pidFile);
}