aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2009-07-09 21:47:24 +0000
committerDaniel Stenberg <daniel@haxx.se>2009-07-09 21:47:24 +0000
commitd709cb2ae37c9d9512fe3a9724dd95b0fe49d108 (patch)
treed68c12351c40178ee635c4aa25679f4af44627c8 /src/main.c
parent444bb03fab4ffd0149d1e4479e24fb038388a6fd (diff)
- 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.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/main.c b/src/main.c
index 87674b83a..b3c470f44 100644
--- a/src/main.c
+++ b/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)