#2220 closed Bug (fixed)
Truncated pointer abused as truth value
Reported by: | naddy | Owned by: | charles |
---|---|---|---|
Priority: | Low | Milestone: | 1.73 |
Component: | Daemon | Version: | 1.72 |
Severity: | Minor | Keywords: | |
Cc: |
Description
Using a pointer as a truth value is perfectly okay, of course. However, assigning a pointer to a shorter integer variable...
watch.c: In function `is_file_in_list': watch.c:144: warning: assignment makes integer from pointer without a cast
... and using the truncated value is wrong:
--- daemon/watch.c.orig Wed Jun 17 14:06:23 2009 +++ daemon/watch.c Wed Jun 17 14:11:17 2009 @@ -141,7 +141,7 @@ is_file_in_list( struct evbuffer * buf, const char * f tr_bool in_list; struct evbuffer * test = evbuffer_new( ); add_file_to_list( test, filename, len ); - in_list = evbuffer_find( buf, EVBUFFER_DATA( test ), EVBUFFER_LENGTH( test ) ); + in_list = evbuffer_find( buf, EVBUFFER_DATA( test ), EVBUFFER_LENGTH( test ) ) != NULL; evbuffer_free( test ); return in_list; }
Change History (3)
comment:1 Changed 13 years ago by charles
- Milestone changed from None Set to 1.80
- Owner set to charles
- Priority changed from Normal to Low
- Severity changed from Normal to Minor
- Status changed from new to assigned
comment:2 Changed 13 years ago by charles
- Resolution set to fixed
- Status changed from assigned to closed
comment:3 Changed 13 years ago by charles
- Milestone changed from 1.80 to 1.73
Note: See
TracTickets for help on using
tickets.
fixed in r8716.