mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-07-14 00:53:21 -07:00
retval+errno return test
This commit is contained in:
parent
07536216c2
commit
fe8e7ded8c
7 changed files with 91 additions and 38 deletions
|
@ -42,8 +42,8 @@
|
|||
void dwr(const char *fmt, ...);
|
||||
|
||||
/* defined in intercept and service */
|
||||
extern FILE* logfile;
|
||||
extern char* logfilename;
|
||||
//extern FILE* logfile;
|
||||
//extern char* logfilename;
|
||||
//extern flog = -1;
|
||||
|
||||
extern pthread_mutex_t loglock;
|
||||
|
@ -78,8 +78,8 @@ extern pthread_mutex_t loglock;
|
|||
timestamp = time(NULL);
|
||||
strftime(timestring, sizeof(timestring), "%H:%M:%S", localtime(×tamp));
|
||||
|
||||
if(logfile)
|
||||
fprintf(logfile, "%s ", timestring);
|
||||
//if(logfile)
|
||||
// fprintf(logfile, "%s ", timestring);
|
||||
fprintf(stderr, "%s ", timestring);
|
||||
|
||||
#ifdef NETCON_SERVICE
|
||||
|
@ -87,13 +87,13 @@ extern pthread_mutex_t loglock;
|
|||
{
|
||||
size_t num_intercepts = ns->intercepts.size();
|
||||
size_t num_connections = ns->connections.size();
|
||||
if(logfile)
|
||||
fprintf(logfile, "[i/c/tid=%3lu|%3lu|%7d]", num_intercepts, num_connections, pid);
|
||||
//if(logfile)
|
||||
// fprintf(logfile, "[i/c/tid=%3lu|%3lu|%7d]", num_intercepts, num_connections, pid);
|
||||
fprintf(stderr, "[i/c/tid=%3lu|%3lu|%7d]", num_intercepts, num_connections, pid);
|
||||
}
|
||||
else {
|
||||
if(logfile)
|
||||
fprintf(logfile, "[i/c/tid=%3d|%3d|%7d]", 0, 0, -1);
|
||||
//if(logfile)
|
||||
// fprintf(logfile, "[i/c/tid=%3d|%3d|%7d]", 0, 0, -1);
|
||||
fprintf(stderr, "[i/c/tid=%3d|%3d|%7d]", 0, 0, -1);
|
||||
}
|
||||
|
||||
|
@ -102,23 +102,23 @@ extern pthread_mutex_t loglock;
|
|||
#ifdef NETCON_INTERCEPT
|
||||
//pthread_mutex_lock(&loglock);
|
||||
int pid = getpid();
|
||||
if(logfile)
|
||||
fprintf(logfile, "[tid=%7d]", pid);
|
||||
//if(logfile)
|
||||
// fprintf(logfile, "[tid=%7d]", pid);
|
||||
fprintf(stderr, "[tid=%7d]", pid);
|
||||
//pthread_mutex_unlock(&loglock);
|
||||
#endif
|
||||
|
||||
if(logfile)
|
||||
fputs(" ", logfile);
|
||||
//if(logfile)
|
||||
// fputs(" ", logfile);
|
||||
fputs(" ", stderr);
|
||||
|
||||
/* logfile */
|
||||
va_start(ap, fmt);
|
||||
saveerr = errno;
|
||||
if(logfile){
|
||||
vfprintf(logfile, fmt, ap);
|
||||
fflush(logfile);
|
||||
}
|
||||
//if(logfile){
|
||||
// vfprintf(logfile, fmt, ap);
|
||||
// fflush(logfile);
|
||||
//}
|
||||
va_end(ap);
|
||||
|
||||
/* console */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue