The following patches make Mbuni compile and run properly on Solaris 9 (tested on x86). The problems were:

- mms_billing_shell.c needs to include sys/wait.h on Solaris to get the WEXITSTATUS macro. - In mms_queue.c, mms_queue_readenvelope opens the queue file O_RDONLY, and then calls mm_lockfile on the fd. mm_lockfile (via lockfile) attempts to lock the file using (under Solaris) fcntl and F_WRLCK. This fails when the file is read only. The patch I've included works around this by opening the file O_RDWR even though we're only reading it. An alternative but possibly more correct solution would be to give an argument to mm_lockfile (and lockfile) to indicate that we want a read lock (F_RDLCK or LOCK_SH in flock parlance) instead.

Thanks!

--
Benno Rice
[EMAIL PROTECTED]
Index: mmlib/mms_queue.c
===================================================================
RCS file: /cvsroot/mbuni/mbuni/mmlib/mms_queue.c,v
retrieving revision 1.40
diff -u -r1.40 mms_queue.c
--- mmlib/mms_queue.c	1 Dec 2008 05:14:55 -0000	1.40
+++ mmlib/mms_queue.c	3 Dec 2008 23:06:58 -0000
@@ -203,7 +203,7 @@
      
      strncpy(xqf, octstr_get_cstr(fname), sizeof xqf);
      
-     if ((fd = open(octstr_get_cstr(fname), O_RDONLY)) < 0) {
+     if ((fd = open(octstr_get_cstr(fname), O_RDWR)) < 0) {
 	  octstr_destroy(fname);
 	  return NULL;
      } else if (mm_lockfile(fd, octstr_get_cstr(fname), shouldblock) != 0) {
Index: mmsc/mms_billing_shell.c
===================================================================
RCS file: /cvsroot/mbuni/mbuni/mmsc/mms_billing_shell.c,v
retrieving revision 1.7
diff -u -r1.7 mms_billing_shell.c
--- mmsc/mms_billing_shell.c	29 Aug 2007 13:33:09 -0000	1.7
+++ mmsc/mms_billing_shell.c	3 Dec 2008 23:06:59 -0000
@@ -13,6 +13,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#ifdef SunOS
+#include <sys/wait.h>
+#endif
+
 #include "mms_billing.h"
 
 static Octstr *script = NULL;
_______________________________________________
Devel mailing list
Devel@mbuni.org
http://lists.mbuni.org/mailman/listinfo/devel

Reply via email to