Rev 8185 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8185 | Rev 12244 | ||
---|---|---|---|
Line 21... | Line 21... | ||
21 | 21 | ||
22 | #include "wims.h" |
22 | #include "wims.h" |
23 | 23 | ||
24 | void cleantmpdir(void) |
24 | void cleantmpdir(void) |
25 | { |
25 | { |
26 |
|
26 | char buf[MAX_LINELEN+1], *p1, *p2; |
27 | 27 | ||
28 |
|
28 | accessfile(buf,"r","%s/exec.pid",tmp_dir); |
29 |
|
29 | for(p1=find_word_start(buf); *p1; p1=find_word_start(p2)) { |
30 |
|
30 | p2=find_word_end(p1); if(*p2) *p2++=0; |
31 |
|
31 | kill(atoi(p1),SIGKILL); |
- | 32 | } |
|
- | 33 | if(strstr(tmp_dir,"sessions/")!=NULL && |
|
- | 34 | (strstr(tmp_debug,"yes")==NULL || checkhost(manager_site)<1)) { |
|
- | 35 | if(remove_tree(tmp_dir)) { |
|
- | 36 | call_ssh("bin/ch..root cleantmpdir 2>/dev/null"); |
|
- | 37 | remove_tree(tmp_dir); |
|
32 | } |
38 | } |
- | 39 | } |
|
33 |
|
40 | else { |
34 |
|
41 | mkfname(buf,"%s/exec.pid",tmp_dir); |
35 |
|
42 | unlink(buf); |
36 |
|
43 | if(strstr(tmp_dir,"sessions/")!=NULL) { |
37 |
|
44 | chmod(tmp_dir,S_IRUSR|S_IWUSR|S_IXUSR); |
38 | } |
- | |
39 | } |
45 | } |
40 | else { |
- | |
41 | mkfname(buf,"%s/exec.pid",tmp_dir); |
- | |
42 | unlink(buf); |
- | |
43 | if(strstr(tmp_dir,"sessions/")!=NULL) { |
- | |
44 | chmod(tmp_dir,S_IRUSR|S_IWUSR|S_IXUSR); |
- | |
45 | } |
- | |
46 |
|
46 | } |
47 | } |
47 | } |
48 | 48 | ||
49 | /* remove pid tag */ |
49 | /* remove pid tag */ |
50 | void delete_pid(void) |
50 | void delete_pid(void) |
51 | { |
51 | { |
52 |
|
52 | char buf[MAX_FNAME+1],pbuf[32]; |
53 | 53 | ||
54 |
|
54 | flushlog(); flushoutput(); |
55 |
|
55 | if(robot_access || *session_prefix==0) return; |
56 |
|
56 | cleantmpdir(); |
57 |
|
57 | mkfname(buf,"%s/.pid",s2_prefix); |
58 |
|
58 | readfile(buf,pbuf,sizeof(pbuf)); |
59 |
|
59 | if(pbuf[0] && strcmp(pbuf,pidbuf)==0) unlink(buf); |
60 |
|
60 | flushlog(); |
61 | } |
61 | } |
62 | - |