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 */ |
26 |
|
#endif |
27 |
|
|
25 |
– |
#ifndef freebsd |
26 |
– |
#define mkfifo(fn,md) mknod(fn, S_IFIFO|(md), 0) |
27 |
– |
#endif |
28 |
– |
|
28 |
|
extern void io_process(); |
29 |
|
|
30 |
|
extern int headismine; /* boolean true if header belongs to me */ |
84 |
|
} |
85 |
|
|
86 |
|
|
87 |
+ |
void |
88 |
|
persistfile(pfn) /* open persist file and lock it */ |
89 |
|
char *pfn; |
90 |
|
{ |
204 |
|
} |
205 |
|
if (nr < 0) |
206 |
|
error(SYSTEM, "error reading persist file"); |
207 |
+ |
#ifndef _WIN32 /* XXX we need a replacement for that one */ |
208 |
|
ftruncate(persistfd, (off_t)0L); /* truncate persist file */ |
209 |
+ |
#endif |
210 |
|
pfdetach(); /* close & release persist file */ |
211 |
|
buf[nr] = '\0'; /* parse what we got */ |
212 |
< |
if ((cp = index(buf, ' ')) == NULL) |
212 |
> |
if ((cp = strchr(buf, ' ')) == NULL) |
213 |
|
goto formerr; |
214 |
|
*cp++ = '\0'; |
215 |
|
if ((pid = atoi(cp)) <= 0) |
216 |
|
goto formerr; |
217 |
< |
if ((cp = index(cp, '\n')) == NULL) |
217 |
> |
if ((cp = strchr(cp, '\n')) == NULL) |
218 |
|
goto formerr; |
219 |
|
pfin = ++cp; |
220 |
< |
if ((cp = index(cp, '\n')) == NULL) |
220 |
> |
if ((cp = strchr(cp, '\n')) == NULL) |
221 |
|
goto formerr; |
222 |
|
*cp++ = '\0'; |
223 |
|
pfout = cp; |
224 |
< |
if ((cp = index(cp, '\n')) == NULL) |
224 |
> |
if ((cp = strchr(cp, '\n')) == NULL) |
225 |
|
goto formerr; |
226 |
|
*cp++ = '\0'; |
227 |
|
pferr = cp; |
228 |
< |
if ((cp = index(cp, '\n')) == NULL) |
228 |
> |
if ((cp = strchr(cp, '\n')) == NULL) |
229 |
|
goto formerr; |
230 |
|
*cp++ = '\0'; |
231 |
|
if (cp-buf != nr) |