Previous code could return a fd that had its file-offset left at the
place where libcurl last used it, namely at the end of the freshly
downloaded file. Not good if a client just wants to read it right
away! We now ensure (and document) that the fd is pointed to the
beginning of the file.
Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
/* PR27571: make cache files casually unwriteable; dirs are already 0700 */
(void) fchmod(fd, 0400);
+ /* PR31248: lseek back to beginning */
+ (void) lseek(fd, 0, SEEK_SET);
/* rename tmp->real */
rc = rename (target_cache_tmppath, target_cache_path);
If a find family function is successful, the resulting file is saved
to the client cache and a file descriptor to that file is returned.
-The caller needs to \fBclose\fP() this descriptor. Otherwise, a
-negative error code is returned.
+The file descriptor points to the beginning of the file. The caller
+needs to \fBclose\fP() this descriptor. Otherwise, a negative error
+code is returned.
.SH "OPTIONAL FUNCTIONS"