# Upload Module Compilation on 64-Bit Architecture

**URL:** <https://www.ruby-forum.com/t/upload-module-compilation-on-64-bit-architecture/152115>\
**Category:** NGINX\
**Created:** [October 30, 2008, 6:34am UTC](https://www.ruby-forum.com/t/upload-module-compilation-on-64-bit-architecture/152115 "2008-10-30T06:34:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brendan\_Schwartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c4cdca/32.png) [@Brendan\_Schwartz](https://www.ruby-forum.com/u/Brendan_Schwartz)\
**Post date:** [October 30, 2008, 6:34am UTC](https://www.ruby-forum.com/t/upload-module-compilation-on-64-bit-architecture/152115/1 "2008-10-30T06:34:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Brendan\_Schwartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c4cdca/32.png) [@Brendan\_Schwartz](https://www.ruby-forum.com/u/Brendan_Schwartz)\
**Post date:** [October 30, 2008, 11:28am UTC](https://www.ruby-forum.com/t/upload-module-compilation-on-64-bit-architecture/152115/2 "2008-10-30T11:28:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Brendan\_Schwartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c4cdca/32.png) [@Brendan\_Schwartz](https://www.ruby-forum.com/u/Brendan_Schwartz)\
**Post date:** [October 30, 2008, 3:17pm UTC](https://www.ruby-forum.com/t/upload-module-compilation-on-64-bit-architecture/152115/3 "2008-10-30T15:17:58Z")

</div>

On Thu, Oct 30, 2008 at 5:39 AM, Valery K. \<  
removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto: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.
