Re: [Devel] Couple of patches

2008-12-04 Thread P. A. Bagyenda

Applied.

 Thanks
On Dec 04, 2008, at 02:08, Benno Rice wrote:

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 -   1.40
+++ mmlib/mms_queue.c   3 Dec 2008 23:06:58 -
@@ -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.c29 Aug 2007 13:33:09 -  1.7
+++ mmsc/mms_billing_shell.c3 Dec 2008 23:06:59 -
@@ -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


___
Devel mailing list
Devel@mbuni.org
http://lists.mbuni.org/mailman/listinfo/devel


[Devel] Couple of patches

2008-12-03 Thread Benno Rice
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 -	1.40
+++ mmlib/mms_queue.c	3 Dec 2008 23:06:58 -
@@ -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 -	1.7
+++ mmsc/mms_billing_shell.c	3 Dec 2008 23:06:59 -
@@ -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