DataSoft / Honeyd

virtual honeypots
GNU General Public License v2.0
349 stars 103 forks source link

Honeyd Compiler Warnings #54

Closed PherricOxide closed 11 years ago

PherricOxide commented 11 years ago

According to our coding style, we try to have a no compiler warning policy (with a few exceptions).

Current warnings follow,

lex.c:1828:17: warning: ‘yyunput’ defined but not used [-Wunused-function]
lex.c:1869:16: warning: ‘input’ defined but not used [-Wunused-function]

lex.c warnings can be ignored IF they can't be prevented by editing lex.l (since lex.c is auto generated and shouldn't be manually modified).

ethernet.c: In function ‘ethernetcode_init’:
ethernet.c:172:8: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]

This probably needs some checking if fgets returns an error.

stats.c: In function ‘stats_ready_cb’:
stats.c:391:7: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
stats.c: In function ‘stats_compress_test’:
stats.c:924:7: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
stats.c:924:7: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
stats.c: In function ‘stats_ready_cb’:
stats.c:391:7: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
stats.c: In function ‘stats_compress_test’:
stats.c:924:7: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
stats.c:924:7: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
stats.c: In function ‘stats_ready_cb’:
stats.c:391:7: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
stats.c: In function ‘stats_compress_test’:
stats.c:924:7: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
stats.c:924:7: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
hsniff.c: In function ‘tcp_drop_subsumed’:
hsniff.c:324:7: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ [-Wformat]
hsniff.c: In function ‘tcp_recv_cb’:
hsniff.c:405:7: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ [-Wformat]

Most of the other warnings are just from using printf with the wrong formatting string. size_t should be formatted with "%z" and long unsigned int should be formatted with "%lu" I believe.

altf4 commented 11 years ago

Only:

lex.c:1828:17: warning: ‘yyunput’ defined but not used [-Wunused-function]
lex.c:1869:16: warning: ‘input’ defined but not used [-Wunused-function]

Seems to remain

PherricOxide commented 11 years ago

Fixed the lex.c compiler warnings in fb8945787fe54c761755ad5b21b1c1be13ce8025