Re: Compiling on FreeBSD

Ben Suffolk <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
>> After the upgrade of GCC it compiles fine, hope that can shed  
>> some  light on the problem for you.
>
> actually: nop ;)

Ok I had a theory, and did a little bit of playing around. I can now  
make it compile under the default version of GCC.

Its because the declaration of the variables pid and *f do not come  
at the start of a block.

Attached is a patch file to do this.


Regards

Ben
gcc29.patch (application/octet-stream, 1.3 KB)
? test/test_conn
? test/test_store_dump
Index: test/test_http_server.c
===================================================================
RCS file: /home/cvs/gateway/test/test_http_server.c,v
retrieving revision 1.33
diff -u -p -r1.33 test_http_server.c
--- test/test_http_server.c	14 Sep 2006 01:05:57 -0000	1.33
+++ test/test_http_server.c	23 Sep 2006 22:09:37 -0000
@@ -179,6 +179,8 @@ static void client_thread(void *arg) 
             octstr_destroy(uri);
         } else if (octstr_compare(url, octstr_imm("/mmsc")) == 0) {
             /* fake a M-Send.conf PDU which is using MMSEncapsulation as body */
+            pid_t pid = getpid();
+            FILE *f;
             gwlist_destroy(resph, octstr_destroy_item);
             octstr_destroy(reply_body);
             reply_type = octstr_create("Content-Type: application/vnd.wap.mms-message");
@@ -193,8 +195,7 @@ static void client_thread(void *arg) 
             resph = gwlist_create();
             gwlist_append(resph, reply_type);
             /* safe the M-Send.req body into a temporary file */
-            pid_t pid = getpid();
-            FILE *f = fopen(octstr_get_cstr(octstr_format("/tmp/mms-body.%ld.%ld", pid, n)), "w");
+            f = fopen(octstr_get_cstr(octstr_format("/tmp/mms-body.%ld.%ld", pid, n)), "w");
             octstr_print(f, body);
             fclose(f);
         }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.