172 |
|
scanorig = ftell(fp); /* record position of first scanline */ |
173 |
|
if (fclose(fp) == -1) /* done with stream i/o */ |
174 |
|
goto filerr; |
175 |
– |
sync(); /* avoid NFS buffering */ |
175 |
|
/* start rpict process */ |
176 |
|
if (open_process(rpd, rpargv) <= 0) { |
177 |
|
fprintf(stderr, "%s: cannot start %s\n", progname, rpargv[0]); |
303 |
|
putpiece(xpos, ypos) /* get next piece from rpict */ |
304 |
|
int xpos, ypos; |
305 |
|
{ |
306 |
+ |
struct flock fls; |
307 |
|
int hr, vr; |
308 |
|
int y; |
309 |
|
|
319 |
|
progname, rpargv[0]); |
320 |
|
exit(1); |
321 |
|
} |
322 |
+ |
fls.l_whence = 1; |
323 |
+ |
fls.l_start = 0L; |
324 |
+ |
fls.l_len = hr*sizeof(COLR); |
325 |
|
for (y = 0; y < vr; y++) { /* transfer scanlines */ |
326 |
|
if (freadcolrs(scanline, hr, fromrp) < 0) { |
327 |
|
fprintf(stderr, "%s: read error from %s\n", |
334 |
|
fprintf(stderr, "%s: seek error\n", outfile); |
335 |
|
exit(1); |
336 |
|
} |
337 |
+ |
fls.l_type = F_WRLCK; |
338 |
+ |
fcntl(outfd, F_SETLKW, &fls); |
339 |
|
if (writebuf(outfd, (char *)scanline, hr*sizeof(COLR)) != |
340 |
|
hr*sizeof(COLR)) { |
341 |
|
fprintf(stderr, "%s: write error\n", outfile); |
342 |
|
exit(1); |
343 |
|
} |
344 |
+ |
fls.l_type = F_UNLCK; |
345 |
+ |
fcntl(outfd, F_SETLKW, &fls); |
346 |
|
} |
347 |
|
} |