Opengate Source Repository
Révision | 162203c25e16fae8eb8be77b3189da062a7f7111 (tree) |
---|---|
l'heure | 2016-05-06 12:57:59 |
Auteur | watanaby <watanaby@user...> |
Commiter | watanaby |
Ver.1.5.36 relpaced signal function.
@@ -43,7 +43,7 @@ doc/ Documentation files | ||
43 | 43 | Changes.html Change log |
44 | 44 | GPL.txt GNU General Public License |
45 | 45 | |
46 | -javahtml/ Client Java Applet and HTML files | |
46 | +javahtml/ Client JavaScript and HTML files | |
47 | 47 | index.html.var Document selector placed in DocumentRoot |
48 | 48 | httpkeep.js JavaScript code for http keep-alive |
49 | 49 | md5.js JavaScript code for MD5 hash |
@@ -787,6 +787,11 @@ Opengate History</H3> | ||
787 | 787 | </DT><DD> |
788 | 788 | Modified comments. |
789 | 789 | </DD> |
790 | + <DT> | |
791 | + Ver.1.5.36 at 2016.5.6 | |
792 | + </DT><DD> | |
793 | + Replaced signal function to NO-RESTART one. | |
794 | + </DD> | |
790 | 795 | </DL> |
791 | 796 | <P> |
792 | 797 | <B>Please see GIT on osdn.jp to check the differences between versions.</B> |
@@ -54,7 +54,7 @@ int openClientGate6(char *clientAddr6, char *userid, char *macAddr6, char *userP | ||
54 | 54 | } |
55 | 55 | |
56 | 56 | /* set timeout */ |
57 | - if((defaultSigFunc=Signal(SIGALRM, sigFunc))==SIG_ERR) return 1; | |
57 | + if((defaultSigFunc=signalx(SIGALRM, sigFunc))==SIG_ERR) return 1; | |
58 | 58 | alarm(atoi(GetConfValue("LockTimeout"))); |
59 | 59 | |
60 | 60 | /* lock */ |
@@ -64,7 +64,7 @@ int openClientGate6(char *clientAddr6, char *userid, char *macAddr6, char *userP | ||
64 | 64 | } |
65 | 65 | |
66 | 66 | /* reset timeout */ |
67 | - Signal(SIGALRM, defaultSigFunc); | |
67 | + signalx(SIGALRM, defaultSigFunc); | |
68 | 68 | alarm(0); |
69 | 69 | |
70 | 70 | /**** read rules ****/ |
@@ -54,7 +54,7 @@ int openClientGate4(char *clientAddr4, char *userid, char *macAddr4, char *userP | ||
54 | 54 | } |
55 | 55 | |
56 | 56 | /* set timeout */ |
57 | - if((defaultSigFunc=Signal(SIGALRM, sigFunc))==SIG_ERR) return 1; | |
57 | + if((defaultSigFunc=signalx(SIGALRM, sigFunc))==SIG_ERR) return 1; | |
58 | 58 | alarm(atoi(GetConfValue("LockTimeout"))); |
59 | 59 | |
60 | 60 | /* lock */ |
@@ -64,7 +64,7 @@ int openClientGate4(char *clientAddr4, char *userid, char *macAddr4, char *userP | ||
64 | 64 | } |
65 | 65 | |
66 | 66 | /* reset timeout */ |
67 | - Signal(SIGALRM, defaultSigFunc); | |
67 | + signalx(SIGALRM, defaultSigFunc); | |
68 | 68 | alarm(0); |
69 | 69 | |
70 | 70 | /**** read rules ****/ |
@@ -213,8 +213,8 @@ int enableAlarm(void) | ||
213 | 213 | pRunningAlarm = p; |
214 | 214 | |
215 | 215 | /* set signal alarm */ |
216 | - if(defaultSigfunc==NULL)defaultSigfunc=signal(SIGALRM, alarmSigFunc); | |
217 | - else signal(SIGALRM, alarmSigFunc); | |
216 | + if(defaultSigfunc==NULL)defaultSigfunc=signalx(SIGALRM, alarmSigFunc); | |
217 | + else signalx(SIGALRM, alarmSigFunc); | |
218 | 218 | alarm(alarmemain); |
219 | 219 | alarmSet=TRUE; |
220 | 220 |
@@ -233,7 +233,7 @@ Time count is not stoped in disable mode | ||
233 | 233 | int disableAlarm(void) |
234 | 234 | { |
235 | 235 | /* reset alarm */ |
236 | - signal(SIGALRM, defaultSigfunc); | |
236 | + signalx(SIGALRM, defaultSigfunc); | |
237 | 237 | alarm(0); |
238 | 238 | |
239 | 239 | return 0; |
@@ -212,7 +212,7 @@ int main(int argc, char **argv) | ||
212 | 212 | CreateCookie(cookie); |
213 | 213 | |
214 | 214 | /* set terminate signal handler */ |
215 | - if(Signal(SIGTERM, closeExit)==SIG_ERR){ | |
215 | + if(signalx(SIGTERM, closeExit)==SIG_ERR){ | |
216 | 216 | PutClientMsg("Error: Please contact the administrator(2)"); |
217 | 217 | return 0; |
218 | 218 | } |
@@ -331,7 +331,7 @@ void closeExit(int signo) | ||
331 | 331 | PutSessionEndToDb(cookie, mode[connectionMode]); |
332 | 332 | |
333 | 333 | /* signal is disabled */ |
334 | - Signal(SIGTERM, SIG_DFL); | |
334 | + signalx(SIGTERM, SIG_DFL); | |
335 | 335 | |
336 | 336 | /* ignore redundant process */ |
337 | 337 | if(connectionMode!=DUPLICATED){ |
@@ -218,7 +218,6 @@ int Pipe(int *fds); | ||
218 | 218 | int Getpeername(int fd, struct sockaddr *sa, socklen_t *salenptr); |
219 | 219 | int Socket(int family, int type, int protocol); |
220 | 220 | int Listen(int fd, int backlog); |
221 | -Sigfunc * Signal(int signo, Sigfunc *func); | |
222 | 221 | void * Malloc(size_t size); |
223 | 222 | |
224 | 223 | char* getenvEx(char* env, int pre, int post); |
@@ -252,3 +251,6 @@ void listAlarm(void); | ||
252 | 251 | /* udp-client.c */ |
253 | 252 | int PutMacAddressToOpengateMd(char* macAddress); |
254 | 253 | int PutDataToUdpPort(char* udpServerAddr, char* udpServerPort, char* buff); |
254 | + | |
255 | +/* signal.c */ | |
256 | +Sigfunc* signalx(int signo, Sigfunc* func); |
@@ -1,41 +1,18 @@ | ||
1 | -/**********************************************************/ | |
2 | -/* signal function */ | |
3 | -/* from UNIX NETWORK PROGRAMMING,Vol.1,Second Edition, */ | |
4 | -/* By W. Richard Stevens, Published By Prentice Hall */ | |
5 | -/* ftp://ftp.kohala.com/pub/rstevens/unpv12e.tar.gz */ | |
6 | -/**********************************************************/ | |
7 | -/* include signal */ | |
8 | 1 | #include "opengatesrv.h" |
9 | 2 | |
10 | -Sigfunc * | |
11 | -signal(int signo, Sigfunc *func) | |
3 | +/**********************************************************/ | |
4 | +/* signal function WITHOUT SA_RESTART */ | |
5 | +/**********************************************************/ | |
6 | +Sigfunc* signalx(int signo, Sigfunc* func) | |
12 | 7 | { |
13 | - struct sigaction act, oact; | |
8 | + struct sigaction act, oldact; | |
14 | 9 | |
15 | - act.sa_handler = func; | |
16 | - sigemptyset(&act.sa_mask); | |
17 | - act.sa_flags = 0; | |
18 | - if (signo == SIGALRM) { | |
19 | -#ifdef SA_INTERRUPT | |
20 | - act.sa_flags |= SA_INTERRUPT; /* SunOS 4.x */ | |
21 | -#endif | |
22 | - } else { | |
23 | -#ifdef SA_RESTART | |
24 | - act.sa_flags |= SA_RESTART; /* SVR4, 44BSD */ | |
25 | -#endif | |
26 | - } | |
27 | - if (sigaction(signo, &act, &oact) < 0) | |
28 | - return(SIG_ERR); | |
29 | - return(oact.sa_handler); | |
30 | -} | |
31 | -/* end signal */ | |
32 | - | |
33 | -Sigfunc * | |
34 | -Signal(int signo, Sigfunc *func) /* for our signal() function */ | |
35 | -{ | |
36 | - Sigfunc *sigfunc; | |
10 | + act.sa_handler = func; | |
11 | + sigemptyset(&act.sa_mask); | |
12 | + act.sa_flags = 0; | |
37 | 13 | |
38 | - if ( (sigfunc = signal(signo, func)) == SIG_ERR) | |
39 | - err_msg("signal error"); | |
40 | - return(sigfunc); | |
14 | + if (sigaction(signo, &act, &oldact) < 0) return(SIG_ERR); | |
15 | + | |
16 | + return(oldact.sa_handler); | |
41 | 17 | } |
18 | + |