*** empty log message ***
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
|
||||
2009-12-01 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||
* Change queue location for MM1 notifications
|
||||
|
|
|
@ -71,7 +71,7 @@ dnl Change a few things (a la kannel config)
|
|||
EXE_EXT=""
|
||||
LIB_EXT="a"
|
||||
case "$host" in
|
||||
*-sun-solaris* | *SunOS*)
|
||||
*-sun-solaris* | *SunOS* | *-pc-solaris*)
|
||||
CFLAGS="$CFLAGS -DSunOS=1 -D_POSIX_PTHREAD_SEMANTICS"
|
||||
;;
|
||||
*-cygwin*)
|
||||
|
|
|
@ -178,7 +178,7 @@ static int mkdf(char df[64], char *mmbox_home)
|
|||
if (fd >= 0 &&
|
||||
mm_lockfile(fd,ctmp,1) != 0) {
|
||||
unlink(ctmp);
|
||||
close(fd);
|
||||
unlock_and_close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
octstr_destroy(tmp);
|
||||
|
@ -202,7 +202,7 @@ static int open_mmbox_index(char *mmbox_dir, int shouldblock)
|
|||
fbuf, strerror(errno));
|
||||
break;
|
||||
} else if (mm_lockfile(fd, fbuf, shouldblock) != 0) {
|
||||
close(fd);
|
||||
unlock_and_close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
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",
|
||||
fbuf, strerror(errno));
|
||||
|
||||
close(tempfd);
|
||||
unlock_and_close(tempfd);
|
||||
tempfd = -1;
|
||||
goto done;
|
||||
|
||||
|
@ -284,7 +284,7 @@ static int update_mmbox_index(int fd, char *mmbox_dir, int cmd,
|
|||
|
||||
fbuf, strerror(errno));
|
||||
|
||||
close(tempfd);
|
||||
unlock_and_close(tempfd);
|
||||
tempfd = -1;
|
||||
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("-"));
|
||||
done:
|
||||
if (dfd > 0)
|
||||
close(dfd);
|
||||
unlock_and_close(dfd);
|
||||
if (ifd > 0)
|
||||
close(ifd);
|
||||
unlock_and_close(ifd);
|
||||
|
||||
if (s)
|
||||
octstr_destroy(s);
|
||||
if (home)
|
||||
octstr_destroy(home);
|
||||
if (state)
|
||||
octstr_destroy(state);
|
||||
if (flags)
|
||||
gwlist_destroy(flags, (gwlist_item_destructor_t *)octstr_destroy);
|
||||
octstr_destroy(s);
|
||||
octstr_destroy(home);
|
||||
octstr_destroy(state);
|
||||
gwlist_destroy(flags, (gwlist_item_destructor_t *)octstr_destroy);
|
||||
|
||||
return sdf;
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
#include <ctype.h>
|
||||
#ifdef SunOS
|
||||
#include <strings.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "mms_queue.h"
|
||||
|
@ -208,7 +208,7 @@ static MmsEnvelope *mms_queue_readenvelope(char *qf, char *mms_queuedir, int sho
|
|||
octstr_destroy(fname);
|
||||
return NULL;
|
||||
} else if (mm_lockfile(fd, octstr_get_cstr(fname), shouldblock) != 0) {
|
||||
close(fd);
|
||||
unlock_and_close(fd);
|
||||
octstr_destroy(fname);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -566,7 +566,7 @@ static int writeenvelope(MmsEnvelope *e, int newenv)
|
|||
close(fd); /* Close new one, keep old one. */
|
||||
res = -1;
|
||||
} else { /* On success, new descriptor replaces old one and we close old one. */
|
||||
close(qfs->fd);
|
||||
unlock_and_close(qfs->fd);
|
||||
qfs->fd = fd;
|
||||
}
|
||||
octstr_destroy(qfname);
|
||||
|
@ -630,7 +630,7 @@ static int mkqf(char qf[QFNAMEMAX], char subdir[64], char *mms_queuedir)
|
|||
if (fd >= 0 &&
|
||||
mm_lockfile(fd,ctmp,1) != 0) {
|
||||
unlink(ctmp);
|
||||
close(fd);
|
||||
unlock_and_close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
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);
|
||||
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);
|
||||
|
||||
|
|
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 */
|
||||
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. */
|
||||
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));
|
||||
break;
|
||||
} else if (mm_lockfile(fd, p, 1) != 0) {
|
||||
close(fd);
|
||||
unlock_and_close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
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) {
|
||||
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);
|
||||
close(fd);
|
||||
unlock_and_close(fd);
|
||||
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);
|
||||
int i, ret;
|
||||
|
||||
fclose(f);
|
||||
unlock_and_fclose(f);
|
||||
if (s && octstr_len(s) == 0) {
|
||||
ret = -1;
|
||||
} 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);
|
||||
return ret;
|
||||
} else if (fd >= 0)
|
||||
close(fd);
|
||||
unlock_and_close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -132,6 +132,6 @@ void mms_dlr_url_remove(Octstr *msgid, char *rtype, Octstr *mmc_gid)
|
|||
octstr_destroy(fname);
|
||||
}
|
||||
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 <stdlib.h>
|
||||
|
||||
#ifndef DARWIN
|
||||
#include <wait.h>
|
||||
#endif
|
||||
#include <sys/wait.h>
|
||||
|
||||
|
||||
|
|
|
@ -59,8 +59,18 @@ int main(int argc, char *argv[])
|
|||
if (!settings)
|
||||
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);
|
||||
#endif
|
||||
signal(SIGTERM, quit_now);
|
||||
signal(SIGINT, quit_now);
|
||||
signal(SIGPIPE,SIG_IGN); /* Ignore pipe errors. They kill us sometimes for no reason*/
|
||||
|
|
Loading…
Reference in New Issue