*** empty log message ***
This commit is contained in:
parent
9693113f21
commit
3223e679cb
|
@ -1,4 +1,6 @@
|
||||||
2009-01-04 P. A. Bagyenda <bagyenda@dsmagic.com>
|
2010-01-25 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||||
|
* SunOS locking fixes (thanks to Ian Donaldson (iand at ekit-inc.com)
|
||||||
|
2010-01-04 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||||
* Minor fix, throttling in MMSC VASP connections
|
* Minor fix, throttling in MMSC VASP connections
|
||||||
2009-12-01 P. A. Bagyenda <bagyenda@dsmagic.com>
|
2009-12-01 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||||
* Change queue location for MM1 notifications
|
* Change queue location for MM1 notifications
|
||||||
|
|
|
@ -71,7 +71,7 @@ dnl Change a few things (a la kannel config)
|
||||||
EXE_EXT=""
|
EXE_EXT=""
|
||||||
LIB_EXT="a"
|
LIB_EXT="a"
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-sun-solaris* | *SunOS*)
|
*-sun-solaris* | *SunOS* | *-pc-solaris*)
|
||||||
CFLAGS="$CFLAGS -DSunOS=1 -D_POSIX_PTHREAD_SEMANTICS"
|
CFLAGS="$CFLAGS -DSunOS=1 -D_POSIX_PTHREAD_SEMANTICS"
|
||||||
;;
|
;;
|
||||||
*-cygwin*)
|
*-cygwin*)
|
||||||
|
|
|
@ -178,7 +178,7 @@ static int mkdf(char df[64], char *mmbox_home)
|
||||||
if (fd >= 0 &&
|
if (fd >= 0 &&
|
||||||
mm_lockfile(fd,ctmp,1) != 0) {
|
mm_lockfile(fd,ctmp,1) != 0) {
|
||||||
unlink(ctmp);
|
unlink(ctmp);
|
||||||
close(fd);
|
unlock_and_close(fd);
|
||||||
fd = -1;
|
fd = -1;
|
||||||
}
|
}
|
||||||
octstr_destroy(tmp);
|
octstr_destroy(tmp);
|
||||||
|
@ -202,7 +202,7 @@ static int open_mmbox_index(char *mmbox_dir, int shouldblock)
|
||||||
fbuf, strerror(errno));
|
fbuf, strerror(errno));
|
||||||
break;
|
break;
|
||||||
} else if (mm_lockfile(fd, fbuf, shouldblock) != 0) {
|
} else if (mm_lockfile(fd, fbuf, shouldblock) != 0) {
|
||||||
close(fd);
|
unlock_and_close(fd);
|
||||||
fd = -1;
|
fd = -1;
|
||||||
}
|
}
|
||||||
while (i++ < MAXTRIES && fd < 0);
|
while (i++ < MAXTRIES && fd < 0);
|
||||||
|
@ -272,7 +272,7 @@ static int update_mmbox_index(int fd, char *mmbox_dir, int cmd,
|
||||||
mms_error(0, "mmbox", NULL,"Failed lock temp file %s: error = %s\n",
|
mms_error(0, "mmbox", NULL,"Failed lock temp file %s: error = %s\n",
|
||||||
fbuf, strerror(errno));
|
fbuf, strerror(errno));
|
||||||
|
|
||||||
close(tempfd);
|
unlock_and_close(tempfd);
|
||||||
tempfd = -1;
|
tempfd = -1;
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ static int update_mmbox_index(int fd, char *mmbox_dir, int cmd,
|
||||||
|
|
||||||
fbuf, strerror(errno));
|
fbuf, strerror(errno));
|
||||||
|
|
||||||
close(tempfd);
|
unlock_and_close(tempfd);
|
||||||
tempfd = -1;
|
tempfd = -1;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -434,18 +434,14 @@ Octstr *mms_mmbox_addmsg(char *mmbox_root, char *user, MmsMsg *msg, List *flag_c
|
||||||
octstr_replace(sdf, octstr_imm("/"), octstr_imm("-"));
|
octstr_replace(sdf, octstr_imm("/"), octstr_imm("-"));
|
||||||
done:
|
done:
|
||||||
if (dfd > 0)
|
if (dfd > 0)
|
||||||
close(dfd);
|
unlock_and_close(dfd);
|
||||||
if (ifd > 0)
|
if (ifd > 0)
|
||||||
close(ifd);
|
unlock_and_close(ifd);
|
||||||
|
|
||||||
if (s)
|
octstr_destroy(s);
|
||||||
octstr_destroy(s);
|
octstr_destroy(home);
|
||||||
if (home)
|
octstr_destroy(state);
|
||||||
octstr_destroy(home);
|
gwlist_destroy(flags, (gwlist_item_destructor_t *)octstr_destroy);
|
||||||
if (state)
|
|
||||||
octstr_destroy(state);
|
|
||||||
if (flags)
|
|
||||||
gwlist_destroy(flags, (gwlist_item_destructor_t *)octstr_destroy);
|
|
||||||
|
|
||||||
return sdf;
|
return sdf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#ifdef SunOS
|
#ifdef SunOS
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
#include <fcntl.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
#include "mms_queue.h"
|
#include "mms_queue.h"
|
||||||
|
@ -208,7 +208,7 @@ static MmsEnvelope *mms_queue_readenvelope(char *qf, char *mms_queuedir, int sho
|
||||||
octstr_destroy(fname);
|
octstr_destroy(fname);
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (mm_lockfile(fd, octstr_get_cstr(fname), shouldblock) != 0) {
|
} else if (mm_lockfile(fd, octstr_get_cstr(fname), shouldblock) != 0) {
|
||||||
close(fd);
|
unlock_and_close(fd);
|
||||||
octstr_destroy(fname);
|
octstr_destroy(fname);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -566,7 +566,7 @@ static int writeenvelope(MmsEnvelope *e, int newenv)
|
||||||
close(fd); /* Close new one, keep old one. */
|
close(fd); /* Close new one, keep old one. */
|
||||||
res = -1;
|
res = -1;
|
||||||
} else { /* On success, new descriptor replaces old one and we close old one. */
|
} else { /* On success, new descriptor replaces old one and we close old one. */
|
||||||
close(qfs->fd);
|
unlock_and_close(qfs->fd);
|
||||||
qfs->fd = fd;
|
qfs->fd = fd;
|
||||||
}
|
}
|
||||||
octstr_destroy(qfname);
|
octstr_destroy(qfname);
|
||||||
|
@ -630,7 +630,7 @@ static int mkqf(char qf[QFNAMEMAX], char subdir[64], char *mms_queuedir)
|
||||||
if (fd >= 0 &&
|
if (fd >= 0 &&
|
||||||
mm_lockfile(fd,ctmp,1) != 0) {
|
mm_lockfile(fd,ctmp,1) != 0) {
|
||||||
unlink(ctmp);
|
unlink(ctmp);
|
||||||
close(fd);
|
unlock_and_close(fd);
|
||||||
fd = -1;
|
fd = -1;
|
||||||
}
|
}
|
||||||
octstr_destroy(tmp);
|
octstr_destroy(tmp);
|
||||||
|
@ -804,7 +804,7 @@ static int free_envelope(MmsEnvelope *e, int removefromqueue)
|
||||||
snprintf(fname, -1 + sizeof fname, "%s/%s%s", qfs->dir, qfs->subdir, qfs->name);
|
snprintf(fname, -1 + sizeof fname, "%s/%s%s", qfs->dir, qfs->subdir, qfs->name);
|
||||||
unlink(fname);
|
unlink(fname);
|
||||||
}
|
}
|
||||||
close(qfs->fd); /* close and unlock now that we have deleted it. */
|
unlock_and_close(qfs->fd); /* close and unlock now that we have deleted it. */
|
||||||
|
|
||||||
mms_queue_free_envelope(e);
|
mms_queue_free_envelope(e);
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -147,6 +147,14 @@ int mm_lockfile(int fd, char *fname, int shouldblock);
|
||||||
/* Returns true if the character is printable or space */
|
/* Returns true if the character is printable or space */
|
||||||
int _mms_gw_isprint(int c);
|
int _mms_gw_isprint(int c);
|
||||||
|
|
||||||
|
int lockfile(int fd, int shouldblock);
|
||||||
|
/*
|
||||||
|
* unlock_and_fclose/unlock_and_close are wrappers around fclose/close
|
||||||
|
* needed to maintain the state of the global list on Solaris.
|
||||||
|
*/
|
||||||
|
int unlock_and_fclose(FILE *fp);
|
||||||
|
int unlock_and_close(int fd);
|
||||||
|
|
||||||
/* Special form of cfg_get which returns zero-length string when there is nothing. */
|
/* Special form of cfg_get which returns zero-length string when there is nothing. */
|
||||||
Octstr *_mms_cfg_getx(mCfg *cfg, mCfgGrp *grp, Octstr *item);
|
Octstr *_mms_cfg_getx(mCfg *cfg, mCfgGrp *grp, Octstr *item);
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ static int dlr_entry_fname(char *msgid, char *rtype, Octstr *mmc_gid, Octstr **e
|
||||||
p, strerror(errno));
|
p, strerror(errno));
|
||||||
break;
|
break;
|
||||||
} else if (mm_lockfile(fd, p, 1) != 0) {
|
} else if (mm_lockfile(fd, p, 1) != 0) {
|
||||||
close(fd);
|
unlock_and_close(fd);
|
||||||
fd = -1;
|
fd = -1;
|
||||||
}
|
}
|
||||||
while (i++ < MAXTRIES && fd < 0);
|
while (i++ < MAXTRIES && fd < 0);
|
||||||
|
@ -92,7 +92,7 @@ void mms_dlr_url_put(Octstr *msgid, char *rtype, Octstr *mmc_gid, Octstr *dlr_ur
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
Octstr *x = octstr_format("%S %S", transid ? transid : octstr_imm("x"), dlr_url); /* better have no spaces in transid! */
|
Octstr *x = octstr_format("%S %S", transid ? transid : octstr_imm("x"), dlr_url); /* better have no spaces in transid! */
|
||||||
octstr_write_data(x, fd, 0);
|
octstr_write_data(x, fd, 0);
|
||||||
close(fd);
|
unlock_and_close(fd);
|
||||||
octstr_destroy(x);
|
octstr_destroy(x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ int mms_dlr_url_get(Octstr *msgid, char *rtype, Octstr *mmc_gid, Octstr **dlr_u
|
||||||
Octstr *s = octstr_read_pipe(f);
|
Octstr *s = octstr_read_pipe(f);
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
fclose(f);
|
unlock_and_fclose(f);
|
||||||
if (s && octstr_len(s) == 0) {
|
if (s && octstr_len(s) == 0) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
} else if ((i = octstr_search_char(s, ' ', 0)) >= 0) {
|
} else if ((i = octstr_search_char(s, ' ', 0)) >= 0) {
|
||||||
|
@ -118,7 +118,7 @@ int mms_dlr_url_get(Octstr *msgid, char *rtype, Octstr *mmc_gid, Octstr **dlr_u
|
||||||
octstr_destroy(s);
|
octstr_destroy(s);
|
||||||
return ret;
|
return ret;
|
||||||
} else if (fd >= 0)
|
} else if (fd >= 0)
|
||||||
close(fd);
|
unlock_and_close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,6 +132,6 @@ void mms_dlr_url_remove(Octstr *msgid, char *rtype, Octstr *mmc_gid)
|
||||||
octstr_destroy(fname);
|
octstr_destroy(fname);
|
||||||
}
|
}
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
close(fd);
|
unlock_and_close(fd);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -12,7 +12,9 @@
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#ifndef DARWIN
|
||||||
|
#include <wait.h>
|
||||||
|
#endif
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,18 @@ int main(int argc, char *argv[])
|
||||||
if (!settings)
|
if (!settings)
|
||||||
panic(0, "No MMSC configuration!");
|
panic(0, "No MMSC configuration!");
|
||||||
|
|
||||||
|
#ifdef SA_RESTART
|
||||||
|
{
|
||||||
|
struct sigaction nact;
|
||||||
|
|
||||||
|
memset(&nact, 0, sizeof(nact));
|
||||||
|
nact.sa_handler = relog_now;
|
||||||
|
nact.sa_flags = SA_RESTART;
|
||||||
|
sigaction(SIGHUP, &nact, (struct sigaction *)0);
|
||||||
|
}
|
||||||
|
#else
|
||||||
signal(SIGHUP, relog_now);
|
signal(SIGHUP, relog_now);
|
||||||
|
#endif
|
||||||
signal(SIGTERM, quit_now);
|
signal(SIGTERM, quit_now);
|
||||||
signal(SIGINT, quit_now);
|
signal(SIGINT, quit_now);
|
||||||
signal(SIGPIPE,SIG_IGN); /* Ignore pipe errors. They kill us sometimes for no reason*/
|
signal(SIGPIPE,SIG_IGN); /* Ignore pipe errors. They kill us sometimes for no reason*/
|
||||||
|
|
Loading…
Reference in New Issue