Message ID | 20220629194432.20229-2-brian.gix@intel.com |
---|---|
State | Superseded |
Headers | show |
Series | [BlueZ,1/2] core: make bt_uuid_hash() portable across archs | expand |
Hi Brian, On Wed, Jun 29, 2022 at 12:56 PM Brian Gix <brian.gix@intel.com> wrote: > > __time_t is not a portable data type, and can cause sign mismatch on > come compares. > > Fixes: > CC src/bluetoothd-device.o > src/device.c: In function ‘device_is_name_resolve_allowed’: > src/device.c:4092:17: error: comparison of integer expressions of different signedness: ‘__time_t’ {aka ‘long int’} and ‘long unsigned int’ [-Werror=sign-compare] > if (now.tv_sec >= device->name_resolve_failed_time + > ^~ > cc1: all warnings being treated as errors > --- > src/device.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/device.c b/src/device.c > index 7b451e458..012d73583 100644 > --- a/src/device.c > +++ b/src/device.c > @@ -4088,7 +4088,7 @@ bool device_is_name_resolve_allowed(struct btd_device *device) > /* now >= failed_time + name_request_retry_delay, meaning the > * period of not sending name request is over. > */ > - if (now.tv_sec >= device->name_resolve_failed_time + > + if ((unsigned)now.tv_sec >= device->name_resolve_failed_time + > btd_opts.name_request_retry_delay) > return true; > > -- > 2.36.1 Can't we just use the same type for name_resolve_failed_time?
diff --git a/src/device.c b/src/device.c index 7b451e458..012d73583 100644 --- a/src/device.c +++ b/src/device.c @@ -4088,7 +4088,7 @@ bool device_is_name_resolve_allowed(struct btd_device *device) /* now >= failed_time + name_request_retry_delay, meaning the * period of not sending name request is over. */ - if (now.tv_sec >= device->name_resolve_failed_time + + if ((unsigned)now.tv_sec >= device->name_resolve_failed_time + btd_opts.name_request_retry_delay) return true;