mirror of
https://github.com/curl/curl.git
synced 2026-07-26 11:57:16 +03:00
- Eric Wong introduced curlx_nonblock() that the curl tool now (re-)uses for
setting a file descriptor non-blocking. Used by the functionality Eric himself brough on June 15th.
This commit is contained in:
parent
444bb03fab
commit
d709cb2ae3
9 changed files with 24 additions and 84 deletions
|
|
@ -4,7 +4,8 @@
|
|||
# the official API, but we re-use the code here to avoid duplication.
|
||||
CURLX_ONES = $(top_srcdir)/lib/strtoofft.c \
|
||||
$(top_srcdir)/lib/strdup.c \
|
||||
$(top_srcdir)/lib/rawstr.c
|
||||
$(top_srcdir)/lib/rawstr.c \
|
||||
$(top_srcdir)/lib/nonblock.c
|
||||
|
||||
CURL_SOURCES = main.c hugehelp.c urlglob.c writeout.c writeenv.c \
|
||||
getpass.c homedir.c curlutil.c os-specific.c
|
||||
|
|
|
|||
19
src/main.c
19
src/main.c
|
|
@ -3231,22 +3231,6 @@ static void go_sleep(long ms)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* maybe we could just use Curl_nonblock() instead ... */
|
||||
static void set_nonblocking(struct Configurable *config, int fd)
|
||||
{
|
||||
#if defined(HAVE_FCNTL_O_NONBLOCK)
|
||||
int flags = fcntl(fd, F_GETFL, 0);
|
||||
|
||||
if (flags >= 0)
|
||||
flags = fcntl(fd, F_SETFL, flags | O_NONBLOCK);
|
||||
else
|
||||
warnf(config, "fcntl failed on fd=%d: %s\n", fd, strerror(errno));
|
||||
#else
|
||||
(void) config;
|
||||
(void) fd;
|
||||
#endif
|
||||
}
|
||||
|
||||
static size_t my_fwrite(void *buffer, size_t sz, size_t nmemb, void *stream)
|
||||
{
|
||||
size_t rc;
|
||||
|
|
@ -4523,7 +4507,8 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
|||
else if(uploadfile && curlx_strequal(uploadfile, "-")) {
|
||||
SET_BINMODE(stdin);
|
||||
infd = STDIN_FILENO;
|
||||
set_nonblocking(config, infd);
|
||||
if (curlx_nonblock((curl_socket_t)infd, TRUE) < 0)
|
||||
warnf(config, "fcntl failed on fd=%d: %s\n", infd, strerror(errno));
|
||||
}
|
||||
|
||||
if(uploadfile && config->resume_from_current)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue