Re: [libvirt] [PATCH] storage: tweak condition to properly test lseek

2015-03-04 Thread Peter Krempa
On Tue, Mar 03, 2015 at 12:10:46 -0700, Eric Blake wrote:
> On 03/03/2015 08:57 AM, Erik Skultety wrote:
> > According to the POSIX standard, off_t (returned by lseek) is defined as
> > signed integral type no shorter than int. Because our offset variable is 
> > defined
> > as unsigned long long, the original check was passed successfully if 
> > UINT64_MAX had
> > been used as offset value, due to implicit conversion.
> > 
> > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1177219
> > ---
> >  src/fdstream.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> ACK.

Pushed; Erik still doesn't have commit access.

Peter


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] storage: tweak condition to properly test lseek

2015-03-03 Thread Eric Blake
On 03/03/2015 08:57 AM, Erik Skultety wrote:
> According to the POSIX standard, off_t (returned by lseek) is defined as
> signed integral type no shorter than int. Because our offset variable is 
> defined
> as unsigned long long, the original check was passed successfully if 
> UINT64_MAX had
> been used as offset value, due to implicit conversion.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1177219
> ---
>  src/fdstream.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

ACK.

> 
> diff --git a/src/fdstream.c b/src/fdstream.c
> index 5d80fc2..b8ea86e 100644
> --- a/src/fdstream.c
> +++ b/src/fdstream.c
> @@ -610,7 +610,7 @@ virFDStreamOpenFileInternal(virStreamPtr st,
>  }
>  
>  if (offset &&
> -lseek(fd, offset, SEEK_SET) != offset) {
> +lseek(fd, offset, SEEK_SET) < 0) {
>  virReportSystemError(errno,
>   _("Unable to seek %s to %llu"),
>   path, offset);
> 

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] storage: tweak condition to properly test lseek

2015-03-03 Thread Erik Skultety
According to the POSIX standard, off_t (returned by lseek) is defined as
signed integral type no shorter than int. Because our offset variable is defined
as unsigned long long, the original check was passed successfully if UINT64_MAX 
had
been used as offset value, due to implicit conversion.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1177219
---
 src/fdstream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/fdstream.c b/src/fdstream.c
index 5d80fc2..b8ea86e 100644
--- a/src/fdstream.c
+++ b/src/fdstream.c
@@ -610,7 +610,7 @@ virFDStreamOpenFileInternal(virStreamPtr st,
 }
 
 if (offset &&
-lseek(fd, offset, SEEK_SET) != offset) {
+lseek(fd, offset, SEEK_SET) < 0) {
 virReportSystemError(errno,
  _("Unable to seek %s to %llu"),
  path, offset);
-- 
1.9.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list