| 113 |
|
for (nleft = (ssize_t)dc.res.xr*dc.res.yr; nleft > 0; nleft -= FBUFLEN) { |
| 114 |
|
for (n = 0; n < FBUFLEN; n++) { |
| 115 |
|
double d = decode_depth_next(&dc); |
| 116 |
< |
if (d < 0) { |
| 116 |
> |
if (d < -FTINY) { |
| 117 |
|
if (n < nleft) |
| 118 |
|
goto badEOF; |
| 119 |
|
break; |
| 129 |
|
} |
| 130 |
|
} |
| 131 |
|
fclose(dc.finp); /* all done -- clean up */ |
| 132 |
< |
if (lseek(fd, 0, SEEK_SET) != 0) |
| 133 |
< |
goto seek_error; |
| 134 |
< |
return(fd); |
| 132 |
> |
if (lseek(fd, 0, SEEK_SET) == 0) |
| 133 |
> |
return(fd); |
| 134 |
> |
seek_error: |
| 135 |
> |
perror("lseek"); |
| 136 |
> |
close(fd); |
| 137 |
> |
return(-1); |
| 138 |
|
badEOF: |
| 139 |
|
fputs(fname, stderr); |
| 140 |
|
fputs(": unexpected end-of-file\n", stderr); |
| 141 |
|
if (dc.finp) fclose(dc.finp); |
| 139 |
– |
close(fd); |
| 140 |
– |
return(-1); |
| 141 |
– |
seek_error: |
| 142 |
– |
perror("lseek"); |
| 142 |
|
close(fd); |
| 143 |
|
return(-1); |
| 144 |
|
} |