Forum: NGINX Upload Module Compilation on 64-Bit Architecture

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Brendan Schwartz (Guest)
on 2008-10-30 07:34
(Received via mailing list)
Hello,

I was unable to compile the latest version (2.0.7) of the Nginx upload
module on a 64-bit system. I tried with both Nginx 0.6.32 and 0.7.19.
I received a warning about a comparison of a signed and unsigned int and
Nginx will abort compilation if a warning is encountered.

I was able to successfully compile Nginx with the upload module by
changing
line 981 in ngx_http_upload_module.c from:

    if(u->output_file.offset + len > ulcf->max_file_size)

to:

    if((unsigned int)(u->output_file.offset + len) >
ulcf->max_file_size)

My C is pretty rusty and I'm hardly acquainted with the Nginx and upload
module source.
So my questions is: was this the right thing to do?

Thanks,
Brendan
Valery K. (Guest)
on 2008-10-30 12:28
(Received via mailing list)
Attachment: off_t.patch (0 Bytes)
Yeah, I know about this problem. I'll fix it in next version. The better
solution from my point of view sounds:

-            if(u->output_file.offset + len > ulcf->max_file_size)
+            if(u->output_file.offset + (off_t)len >
ulcf->max_file_size)

Patch is attached.
Brendan Schwartz (Guest)
on 2008-10-30 16:17
(Received via mailing list)
On Thu, Oct 30, 2008 at 5:39 AM, Valery K. <
removed_email_address@domain.invalid <removed_email_address@domain.invalid>> 
wrote:

> > module on a 64-bit system. I tried with both Nginx 0.6.32 and 0.7.19.
> >
> >     if((unsigned int)(u->output_file.offset + len) > ulcf->max_file_size)
> >
> > My C is pretty rusty and I'm hardly acquainted with the Nginx and upload
> > module source.
> > So my questions is: was this the right thing to do?
>
> --
> Best regards,
> Valery K.


Thanks Valery! I just put the upload module into production last night.
So
far so good! Thanks for all your hard work on it -- it's a much needed
module.
This topic is locked and can not be replied to.