Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ZerXes
Tor
Commits
efbcd71b
Commit
efbcd71b
authored
Jun 21, 2003
by
Nick Mathewson
🐻
Browse files
Remove false warnings from printf checks
svn:r340
parent
49f082fc
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/common/log.c
View file @
efbcd71b
...
...
@@ -42,33 +42,36 @@ size_t sev_to_string(char *buf, int max, int severity) {
return
strlen
(
buf
)
+
1
;
}
static
int
loglevel
=
LOG_DEBUG
;
static
void
logv
(
int
severity
,
const
char
*
funcname
,
const
char
*
format
,
va_list
ap
)
{
static
int
loglevel
=
LOG_DEBUG
;
char
buf
[
201
];
time_t
t
;
struct
timeval
now
;
if
(
format
)
{
if
(
severity
>
loglevel
)
return
;
if
(
gettimeofday
(
&
now
,
NULL
)
<
0
)
return
;
assert
(
format
);
if
(
severity
>
loglevel
)
return
;
if
(
gettimeofday
(
&
now
,
NULL
)
<
0
)
return
;
t
=
time
(
NULL
);
strftime
(
buf
,
200
,
"%b %d %H:%M:%S"
,
localtime
(
&
t
));
printf
(
"%s.%.3ld "
,
buf
,
(
long
)
now
.
tv_usec
/
1000
);
sev_to_string
(
buf
,
200
,
severity
);
printf
(
"[%s] "
,
buf
);
if
(
funcname
)
printf
(
"%s(): "
,
funcname
);
vprintf
(
format
,
ap
);
printf
(
"
\n
"
);
}
else
loglevel
=
severity
;
t
=
time
(
NULL
);
strftime
(
buf
,
200
,
"%b %d %H:%M:%S"
,
localtime
(
&
t
));
printf
(
"%s.%.3ld "
,
buf
,
(
long
)
now
.
tv_usec
/
1000
);
sev_to_string
(
buf
,
200
,
severity
);
printf
(
"[%s] "
,
buf
);
if
(
funcname
)
printf
(
"%s(): "
,
funcname
);
vprintf
(
format
,
ap
);
printf
(
"
\n
"
);
}
void
log_set_severity
(
int
severity
)
{
loglevel
=
severity
;
}
/* Outputs a message to stdout */
...
...
src/common/log.h
View file @
efbcd71b
...
...
@@ -17,6 +17,8 @@
#define CHECK_PRINTF(formatIdx, firstArg)
#endif
void
log_set_severity
(
int
severity
);
/* Outputs a message to stdout and also logs the same message using syslog. */
void
log
(
int
severity
,
const
char
*
format
,
...)
CHECK_PRINTF
(
2
,
3
);
...
...
src/or/circuit.c
View file @
efbcd71b
...
...
@@ -473,7 +473,7 @@ void circuit_close(circuit_t *circ) {
assert
(
circ
);
if
(
options
.
APPort
)
{
youngest
=
circuit_get_newest_ap
();
log_fn
(
LOG_DEBUG
,
"youngest %d, circ %d."
,
youngest
,
(
int
)
circ
);
log_fn
(
LOG_DEBUG
,
"youngest %d, circ %d."
,
(
int
)
youngest
,
(
int
)
circ
);
}
circuit_remove
(
circ
);
if
(
circ
->
n_conn
)
...
...
src/or/main.c
View file @
efbcd71b
...
...
@@ -792,7 +792,7 @@ int tor_main(int argc, char *argv[]) {
if
(
getconfig
(
argc
,
argv
,
&
options
))
exit
(
1
);
log
(
options
.
loglevel
,
NULL
);
/* assign logging severity level from options */
log
_set_severity
(
options
.
loglevel
);
/* assign logging severity level from options */
if
(
options
.
Daemon
)
daemonize
();
...
...
src/or/onion.c
View file @
efbcd71b
...
...
@@ -329,7 +329,7 @@ crypt_path_t *onion_generate_cpath(routerinfo_t **firsthop) {
log
(
LOG_DEBUG
,
"onion_generate_cpath(): %u : %s:%u, %u/%u"
,
routelen
-
i
,
inet_ntoa
(
netaddr
),
(
rarray
[
route
[
i
]])
->
or_port
,
(
rarray
[
route
[
i
]])
->
pkey
,
(
int
)
(
rarray
[
route
[
i
]])
->
pkey
,
crypto_pk_keysize
((
rarray
[
route
[
i
]])
->
pkey
));
}
...
...
src/or/test.c
View file @
efbcd71b
...
...
@@ -594,7 +594,7 @@ main(int c, char**v){
if(getconfig(c,v,&options))
exit(1);
#endif
log
(
LOG_ERR
,
NULL
);
/* make logging quieter */
log
_set_severity
(
LOG_ERR
);
/* make logging quieter */
crypto_seed_rng
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment