9 |
|
|
10 |
|
#include "copyright.h" |
11 |
|
|
12 |
+ |
#include <string.h> |
13 |
+ |
#include <signal.h> |
14 |
+ |
#include <sys/stat.h> |
15 |
+ |
|
16 |
+ |
#include "rtprocess.h" /* getpid() */ |
17 |
|
#include "standard.h" |
18 |
|
#include "random.h" |
19 |
|
|
20 |
|
#ifdef F_SETLKW |
21 |
|
#include "paths.h" |
22 |
|
#include "selcall.h" |
18 |
– |
#include <signal.h> |
19 |
– |
#include <sys/stat.h> |
23 |
|
|
24 |
|
#ifndef TIMELIM |
25 |
|
#define TIMELIM (8*3600) /* time limit for holding pattern */ |
88 |
|
} |
89 |
|
|
90 |
|
|
91 |
+ |
void |
92 |
|
persistfile(pfn) /* open persist file and lock it */ |
93 |
|
char *pfn; |
94 |
|
{ |
208 |
|
} |
209 |
|
if (nr < 0) |
210 |
|
error(SYSTEM, "error reading persist file"); |
211 |
+ |
#ifndef _WIN32 /* XXX we need a replacement for that one */ |
212 |
|
ftruncate(persistfd, (off_t)0L); /* truncate persist file */ |
213 |
+ |
#endif |
214 |
|
pfdetach(); /* close & release persist file */ |
215 |
|
buf[nr] = '\0'; /* parse what we got */ |
216 |
< |
if ((cp = index(buf, ' ')) == NULL) |
216 |
> |
if ((cp = strchr(buf, ' ')) == NULL) |
217 |
|
goto formerr; |
218 |
|
*cp++ = '\0'; |
219 |
|
if ((pid = atoi(cp)) <= 0) |
220 |
|
goto formerr; |
221 |
< |
if ((cp = index(cp, '\n')) == NULL) |
221 |
> |
if ((cp = strchr(cp, '\n')) == NULL) |
222 |
|
goto formerr; |
223 |
|
pfin = ++cp; |
224 |
< |
if ((cp = index(cp, '\n')) == NULL) |
224 |
> |
if ((cp = strchr(cp, '\n')) == NULL) |
225 |
|
goto formerr; |
226 |
|
*cp++ = '\0'; |
227 |
|
pfout = cp; |
228 |
< |
if ((cp = index(cp, '\n')) == NULL) |
228 |
> |
if ((cp = strchr(cp, '\n')) == NULL) |
229 |
|
goto formerr; |
230 |
|
*cp++ = '\0'; |
231 |
|
pferr = cp; |
232 |
< |
if ((cp = index(cp, '\n')) == NULL) |
232 |
> |
if ((cp = strchr(cp, '\n')) == NULL) |
233 |
|
goto formerr; |
234 |
|
*cp++ = '\0'; |
235 |
|
if (cp-buf != nr) |