mirror of
https://github.com/moparisthebest/curl
synced 2024-10-31 15:45:12 -04:00
Better cope with a failed or unavailable ftruncate().
Added HAVE_FTRUNCATE to all the static config-*.h files on the assumption that all those systems provide it.
This commit is contained in:
parent
31891b55a4
commit
42ac24448c
@ -96,6 +96,9 @@
|
|||||||
/* Define if you have the strstr function. */
|
/* Define if you have the strstr function. */
|
||||||
#define HAVE_STRSTR 1
|
#define HAVE_STRSTR 1
|
||||||
|
|
||||||
|
/* Define if you have the ftruncate function. */
|
||||||
|
#define HAVE_FTRUNCATE 1
|
||||||
|
|
||||||
/* Define if you have the uname function. */
|
/* Define if you have the uname function. */
|
||||||
#define HAVE_UNAME 1
|
#define HAVE_UNAME 1
|
||||||
|
|
||||||
|
@ -280,6 +280,7 @@ config.h: Makefile.netware
|
|||||||
@echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@
|
@echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@
|
@echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
|
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@
|
@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#define HAVE_TIME_H 1
|
#define HAVE_TIME_H 1
|
||||||
#define TIME_WITH_SYS_TIME 1
|
#define TIME_WITH_SYS_TIME 1
|
||||||
#define HAVE_TERMIOS_H 1
|
#define HAVE_TERMIOS_H 1
|
||||||
|
#define HAVE_FTRUNCATE 1
|
||||||
|
|
||||||
#define HAVE_PWD_H 1
|
#define HAVE_PWD_H 1
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#define HAVE_SETVBUF 1
|
#define HAVE_SETVBUF 1
|
||||||
#define HAVE_UTIME 1
|
#define HAVE_UTIME 1
|
||||||
|
#define HAVE_FTRUNCATE 1
|
||||||
|
|
||||||
#define main(x,y) curl_main(x,y)
|
#define main(x,y) curl_main(x,y)
|
||||||
|
|
||||||
|
@ -89,6 +89,9 @@
|
|||||||
/* Define if you have the <fcntl.h> header file. */
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
#define HAVE_FCNTL_H
|
#define HAVE_FCNTL_H
|
||||||
|
|
||||||
|
/* Define if you have the `ftruncate' function. */
|
||||||
|
#define HAVE_FTRUNCATE
|
||||||
|
|
||||||
/* Define if getaddrinfo exists and works */
|
/* Define if getaddrinfo exists and works */
|
||||||
#define HAVE_GETADDRINFO
|
#define HAVE_GETADDRINFO
|
||||||
|
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
/* Define if you have the <io.h> header file. */
|
/* Define if you have the <io.h> header file. */
|
||||||
#undef HAVE_IO_H
|
#undef HAVE_IO_H
|
||||||
|
|
||||||
|
/* Define if you have ftruncate() */
|
||||||
|
#define HAVE_FTRUNCATE 1
|
||||||
|
|
||||||
/* Define if you have strdup() */
|
/* Define if you have strdup() */
|
||||||
#define HAVE_STRDUP 1
|
#define HAVE_STRDUP 1
|
||||||
|
|
||||||
|
@ -14,6 +14,9 @@
|
|||||||
/* Define if you have the <limits.h> header file */
|
/* Define if you have the <limits.h> header file */
|
||||||
#define HAVE_LIMITS_H 1
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the ftruncate function. */
|
||||||
|
#define HAVE_FTRUNCATE 1
|
||||||
|
|
||||||
/* Define if you have the strdup function. */
|
/* Define if you have the strdup function. */
|
||||||
#define HAVE_STRDUP 1
|
#define HAVE_STRDUP 1
|
||||||
|
|
||||||
|
@ -3771,10 +3771,12 @@ operate(struct Configurable *config, int argc, char *argv[])
|
|||||||
" bytes\n", outs.bytes);
|
" bytes\n", outs.bytes);
|
||||||
fflush(outs.stream);
|
fflush(outs.stream);
|
||||||
/* truncate file at the position where we started appending */
|
/* truncate file at the position where we started appending */
|
||||||
|
#ifdef HAVE_FTRUNCATE
|
||||||
ftruncate( fileno(outs.stream), outs.init);
|
ftruncate( fileno(outs.stream), outs.init);
|
||||||
|
#endif
|
||||||
/* now seek to the end of the file, the position where we
|
/* now seek to the end of the file, the position where we
|
||||||
just truncated the file */
|
just truncated the file */
|
||||||
fseek(outs.stream, 0, SEEK_END);
|
fseek(outs.stream, outs.init, SEEK_SET);
|
||||||
outs.bytes = 0; /* clear for next round */
|
outs.bytes = 0; /* clear for next round */
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user