| 34 |
if (fp_log_err == NULL) |
if (fp_log_err == NULL) |
| 35 |
{ |
{ |
| 36 |
perror ("log_begin failed\n"); |
perror ("log_begin failed\n"); |
| 37 |
return -1; |
return -2; |
| 38 |
} |
} |
| 39 |
|
|
| 40 |
return 0; |
return 0; |
| 72 |
} |
} |
| 73 |
|
|
| 74 |
log_head(buf); |
log_head(buf); |
| 75 |
|
|
| 76 |
strcat(buf,msg); |
strcat(buf,msg); |
| 77 |
|
|
| 78 |
if (fprintf (fp_log_std, buf)<0) |
if (fprintf (fp_log_std, buf)<0) |
| 98 |
} |
} |
| 99 |
|
|
| 100 |
log_head(buf); |
log_head(buf); |
| 101 |
|
|
| 102 |
strcat(buf,error_msg); |
strcat(buf,error_msg); |
| 103 |
|
|
| 104 |
if (fprintf (fp_log_err, buf)<0) |
if (fprintf (fp_log_err, buf)<0) |
| 111 |
|
|
| 112 |
return 0; |
return 0; |
| 113 |
} |
} |
| 114 |
|
|
| 115 |
|
int |
| 116 |
|
log_std_redirect(int fd) |
| 117 |
|
{ |
| 118 |
|
int ret; |
| 119 |
|
close (fileno(fp_log_std)); |
| 120 |
|
ret = dup2(fd, fileno(fp_log_std)); |
| 121 |
|
return ret; |
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
int |
| 125 |
|
log_err_redirect(int fd) |
| 126 |
|
{ |
| 127 |
|
int ret; |
| 128 |
|
close (fileno(fp_log_err)); |
| 129 |
|
ret = dup2(fd, fileno(fp_log_err)); |
| 130 |
|
return ret; |
| 131 |
|
} |