[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#154939: Patch



tags 154939 + patch
thanks

See below.

Gruss/Regards,
Eduard.

diff -urd boa-0.94.13.original/debian/rules boa-0.94.13/debian/rules
--- boa-0.94.13.original/debian/rules	2002-08-17 20:42:36.000000000 +0200
+++ boa-0.94.13/debian/rules	2002-08-18 00:13:59.000000000 +0200
@@ -18,7 +18,7 @@
 
 build-stamp:
 	dh_testdir
-	cd src;./configure;make
+	cd src; CFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE" ./configure;make
 	cd docs;make boa.html boa.info
 	touch build-stamp
 
diff -urd boa-0.94.13.original/src/boa.h boa-0.94.13/src/boa.h
--- boa-0.94.13.original/src/boa.h	2002-07-26 05:03:44.000000000 +0200
+++ boa-0.94.13/src/boa.h	2002-08-18 00:14:05.000000000 +0200
@@ -149,8 +149,9 @@
 void clean_pathname(char *pathname);
 char *get_commonlog_time(void);
 void rfc822_time_buf(char *buf, time_t s);
-char *simple_itoa(unsigned int i);
+char *simple_itoa(long long int i);
 int boa_atoi(char *s);
+long long int boa_atoll(char *s);
 char *escape_string(char *inp, char *buf);
 int month2int(char *month);
 int modified_since(time_t * mtime, char *if_modified_since);
diff -urd boa-0.94.13.original/src/get.c boa-0.94.13/src/get.c
--- boa-0.94.13.original/src/get.c	2002-07-26 05:05:59.000000000 +0200
+++ boa-0.94.13/src/get.c	2002-08-17 23:42:55.000000000 +0200
@@ -43,7 +43,7 @@
     struct stat statbuf;
     volatile int bytes;
 
-    data_fd = open(req->pathname, O_RDONLY);
+    data_fd = open(req->pathname, O_RDONLY | O_LARGEFILE);
     saved_errno = errno; /* might not get used */
 
 #ifdef GUNZIP
@@ -58,7 +58,7 @@
         memcpy(gzip_pathname, req->pathname, len);
         memcpy(gzip_pathname + len, ".gz", 3);
         gzip_pathname[len + 3] = '\0';
-        data_fd = open(gzip_pathname, O_RDONLY);
+        data_fd = open(gzip_pathname, O_RDONLY | O_LARGEFILE);
         if (data_fd != -1) {
             close(data_fd);
 
@@ -313,7 +313,7 @@
            sprintf(pathname_with_index, "%s%s", req->pathname, directory_index);
          */
 
-        data_fd = open(pathname_with_index, O_RDONLY);
+        data_fd = open(pathname_with_index, O_RDONLY | O_LARGEFILE);
 
         if (data_fd != -1) {    /* user's index file */
             strcpy(req->request_uri, directory_index); /* for mimetype */
@@ -334,7 +334,7 @@
          * try index.html.gz
          */
         strcat(pathname_with_index, ".gz");
-        data_fd = open(pathname_with_index, O_RDONLY);
+        data_fd = open(pathname_with_index, O_RDONLY | O_LARGEFILE);
         if (data_fd != -1) {    /* user's index file */
             close(data_fd);
 
@@ -399,9 +399,9 @@
     time_t real_dir_mtime;
 
     real_dir_mtime = statbuf->st_mtime;
-    sprintf(pathname_with_index, "%s/dir.%d.%ld",
+    sprintf(pathname_with_index, "%s/dir.%d.%lld",
             cachedir, (int) statbuf->st_dev, statbuf->st_ino);
-    data_fd = open(pathname_with_index, O_RDONLY);
+    data_fd = open(pathname_with_index, O_RDONLY | O_LARGEFILE);
 
     if (data_fd != -1) {        /* index cache */
 
@@ -417,7 +417,7 @@
     if (index_directory(req, pathname_with_index) == -1)
         return -1;
 
-    data_fd = open(pathname_with_index, O_RDONLY); /* Last chance */
+    data_fd = open(pathname_with_index, O_RDONLY | O_LARGEFILE); /* Last chance */
     if (data_fd != -1) {
         strcpy(req->request_uri, directory_index); /* for mimetype */
         fstat(data_fd, statbuf);
diff -urd boa-0.94.13.original/src/globals.h boa-0.94.13/src/globals.h
--- boa-0.94.13.original/src/globals.h	2002-07-24 05:03:59.000000000 +0200
+++ boa-0.94.13/src/globals.h	2002-08-17 23:38:01.000000000 +0200
@@ -54,8 +54,8 @@
     int kacount;                /* keepalive count */
 
     int data_fd;                /* fd of data */
-    unsigned long filesize;     /* filesize */
-    unsigned long filepos;      /* position in file */
+    unsigned long long filesize;     /* filesize */
+    unsigned long long filepos;      /* position in file */
     char *data_mem;             /* mmapped/malloced char array */
     int method;                 /* M_GET, M_POST, etc. */
 
diff -urd boa-0.94.13.original/src/index_dir.c boa-0.94.13/src/index_dir.c
--- boa-0.94.13.original/src/index_dir.c	2002-01-30 04:41:45.000000000 +0100
+++ boa-0.94.13/src/index_dir.c	2002-08-17 23:30:47.000000000 +0200
@@ -240,10 +240,10 @@
         printf("<tr>"
                "<td width=\"40%%\"><a href=\"%s/\">%s/</a></td>"
                "<td align=right>%s</td>"
-               "<td align=right>%ld bytes</td>"
+               "<td align=right>%lld bytes</td>"
                "</tr>\n",
                http_filename, html_filename,
-               ctime(&statbuf.st_mtime), (long) statbuf.st_size);
+               ctime(&statbuf.st_mtime), (long long) statbuf.st_size);
     }
 
     printf
@@ -281,19 +281,19 @@
                    "<td width=\"40%%\"><a href=\"%s\">%s</a> "
                    "<a href=\"%s.gz\">(.gz)</a></td>"
                    "<td align=right>%s</td>"
-                   "<td align=right>%ld bytes</td>"
+                   "<td align=right>%lld bytes</td>"
                    "</tr>\n",
                    http_filename, html_filename, http_filename,
-                   ctime(&statbuf.st_mtime), (long) statbuf.st_size);
+                   ctime(&statbuf.st_mtime), (long long) statbuf.st_size);
         } else {
 #endif
             printf("<tr>"
                    "<td width=\"40%%\"><a href=\"%s\">%s</a></td>"
                    "<td align=right>%s</td>"
-                   "<td align=right>%ld bytes</td>"
+                   "<td align=right>%lld bytes</td>"
                    "</tr>\n",
                    http_filename, html_filename,
-                   ctime(&statbuf.st_mtime), (long) statbuf.st_size);
+                   ctime(&statbuf.st_mtime), (long long) statbuf.st_size);
 #ifdef GUNZIP
         }
 #endif
diff -urd boa-0.94.13.original/src/log.c boa-0.94.13/src/log.c
--- boa-0.94.13.original/src/log.c	2002-07-26 05:04:48.000000000 +0200
+++ boa-0.94.13/src/log.c	2002-08-17 23:38:33.000000000 +0200
@@ -142,7 +142,7 @@
     if (access_log) {
         if (virtualhost)
             fprintf(access_log, "%s ", req->local_ip_addr);
-        fprintf(access_log, "%s - - %s\"%s\" %d %ld \"%s\" \"%s\"\n",
+        fprintf(access_log, "%s - - %s\"%s\" %d %lld \"%s\" \"%s\"\n",
                 req->remote_ip_addr,
                 get_commonlog_time(),
                 req->logline,
diff -urd boa-0.94.13.original/src/mmap_cache.c boa-0.94.13/src/mmap_cache.c
--- boa-0.94.13.original/src/mmap_cache.c	2002-03-24 23:35:34.000000000 +0100
+++ boa-0.94.13/src/mmap_cache.c	2002-08-17 23:41:01.000000000 +0200
@@ -104,7 +104,7 @@
     int data_fd;
     struct stat statbuf;
     struct mmap_entry *e;
-    data_fd = open(fname, O_RDONLY);
+    data_fd = open(fname, O_RDONLY | O_LARGEFILE);
     if (data_fd == -1) {
         perror(fname);
         return NULL;
diff -urd boa-0.94.13.original/src/read.c boa-0.94.13/src/read.c
--- boa-0.94.13.original/src/read.c	2002-03-18 02:53:48.000000000 +0100
+++ boa-0.94.13/src/read.c	2002-08-17 23:53:53.000000000 +0200
@@ -157,7 +157,7 @@
                 if (req->content_length) {
                     int content_length;
 
-                    content_length = boa_atoi(req->content_length);
+                    content_length = boa_atoll(req->content_length);
                     /* Is a content-length of 0 legal? */
                     if (content_length <= 0) {
                         log_error_time();
diff -urd boa-0.94.13.original/src/util.c boa-0.94.13/src/util.c
--- boa-0.94.13.original/src/util.c	2002-07-08 01:22:18.000000000 +0200
+++ boa-0.94.13/src/util.c	2002-08-18 00:02:14.000000000 +0200
@@ -386,7 +386,7 @@
     memcpy(p, day_tab + t->tm_wday * 4, 4);
 }
 
-char *simple_itoa(unsigned int i)
+char *simple_itoa(long long int i)
 {
     /* 21 digits plus null terminator, good for 64-bit or smaller ints
      * for bigger ints, use a bigger buffer!
@@ -427,6 +427,24 @@
     return retval;
 }
 
+/* I don't "do" negative conversions
+ * Therefore, -1 indicates error
+ */
+
+long long int boa_atoll(char *s)
+{
+    long long int retval;
+
+    if (!isdigit(*s))
+        return -1;
+
+    retval = atoll(s);
+    if (retval < 0)
+        return -1;
+
+    return retval;
+}
+
 int create_temporary_file(short want_unlink, char *storage, int size)
 {
     static char boa_tempfile[MAX_PATH_LENGTH + 1];

-- 
<ij> Alfie: schonmal davon gehoert, dass nicht jeder linux user gleich ein
        programmierer ist, der alles, was er selber braucht, auch selber
        programmiert, installiert, patched, hacked oder portiert?
<Alfie> ij: Urks?  Das ist doch nur eine Legende.....
                                  -- #debian.de




Reply to: