use netdata logging facility
Costa Tsaousis (ktsaou) committed
Nov 21, 2015 at 01:32 UTC
83bd7bf3c12fb9de513f673b32ca15908bb5420b
1 file changed
+4
-4
src/popen.c
+4
-4
@@ -101,13 +101,13 @@ FILE *mypopen(const char *command, pid_t *pidptr)
101
102
// set a new process group id for just this child
103
if( setpgid(0, 0) != 0 )
104
- fprintf(stderr, "Cannot set a new process group for pid %d (%s)\n", getpid(), strerror(errno));
104
+ error("Cannot set a new process group for pid %d (%s)", getpid(), strerror(errno));
105
106
if( getpgid(0) != getpid() )
107
- fprintf(stderr, "Process group set is incorrect. Expected %d, found %d\n", getpid(), getpgid(0));
107
+ error("Process group set is incorrect. Expected %d, found %d", getpid(), getpgid(0));
108
109
if( setsid() != 0 )
110
- fprintf(stderr, "Cannot set session id for pid %d (%s)\n", getpid(), strerror(errno));
110
+ error("Cannot set session id for pid %d (%s)", getpid(), strerror(errno));
111
112
fprintf(stdout, "MYPID %d\n", getpid());
113
fflush(NULL);
@@ -116,7 +116,7 @@ FILE *mypopen(const char *command, pid_t *pidptr)
116
// reset all signals
117
for (i = 1 ; i < 65 ;i++) if(i != SIGSEGV) signal(i, SIG_DFL);
118
119
- fprintf(stderr, "executing command: '%s' on pid %d.\n", command, getpid());
119
+ info("executing command: '%s' on pid %d.", command, getpid());
120
execl("/bin/sh", "sh", "-c", command, NULL);
121
exit(1);
122
}