]> granicus.if.org Git - curl/commitdiff
Added comments about checking return code and the maxfd counter
authorDaniel Stenberg <daniel@haxx.se>
Fri, 13 Oct 2006 14:01:19 +0000 (14:01 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 13 Oct 2006 14:01:19 +0000 (14:01 +0000)
docs/examples/10-at-a-time.c
docs/examples/fopen.c
docs/examples/multi-app.c
docs/examples/multi-debugcallback.c
docs/examples/multi-double.c
docs/examples/multi-post.c
docs/examples/multi-single.c

index be3b6faee16667867caf70a26fa6f712b87c2a17..50392259cbe5b297cf75f3d570bcd1b0172c7df3 100644 (file)
@@ -123,6 +123,9 @@ int main(void)
         return EXIT_FAILURE;
       }
 
+      /* In a real-world program you OF COURSE check the return that maxfd is
+         bigger than -1 so that the call to select() below makes sense! */
+
       if (curl_multi_timeout(cm, &L)) {
         fprintf(stderr, "E: curl_multi_timeout\n");
         return EXIT_FAILURE;
index a2e6fc94ade372bb91a0966c4ddda8c350401b19..de235bbc4cbf12c35199f02feccb0cc20a2f9fc0 100644 (file)
@@ -153,6 +153,10 @@ fill_buffer(URL_FILE *file,int want,int waittime)
         /* get file descriptors from the transfers */
         curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
 
+        /* In a real-world program you OF COURSE check the return code of the
+           function calls, *and* you make sure that maxfd is bigger than -1
+           so that the call to select() below makes sense! */
+
         rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
 
         switch(rc) {
index 5383a40ae99f1716e04cc730e328c4775dc85cc1..6c0ef7e7f1c8d63a1c50be03bef58b825e7fde48 100644 (file)
@@ -80,6 +80,10 @@ int main(int argc, char **argv)
     /* get file descriptors from the transfers */
     curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
 
+    /* In a real-world program you OF COURSE check the return code of the
+       function calls, *and* you make sure that maxfd is bigger than -1 so
+       that the call to select() below makes sense! */
+
     rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
 
     switch(rc) {
index 28626721947d49c487e2bd4ccdab6ead23fd9f6c..4c93df4dc1b08657afc8f04dc44461b1139aab33 100644 (file)
@@ -153,6 +153,10 @@ int main(int argc, char **argv)
     /* get file descriptors from the transfers */
     curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
 
+    /* In a real-world program you OF COURSE check the return code of the
+       function calls, *and* you make sure that maxfd is bigger than -1
+       so that the call to select() below makes sense! */
+
     rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
 
     switch(rc) {
index 51b4ed37011cf5b96546461e6fe15aa635cd11be..0a4cde855e9c970c29fd5eb578d00ebf5eec514d 100644 (file)
@@ -71,6 +71,10 @@ int main(int argc, char **argv)
     /* get file descriptors from the transfers */
     curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
 
+    /* In a real-world program you OF COURSE check the return code of the
+       function calls, *and* you make sure that maxfd is bigger than -1 so
+       that the call to select() below makes sense! */
+
     rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
 
     switch(rc) {
index b89e2d6321331e9096b635bf11d87d2b828d1739..894ace0ed52338ed1eeba59d9db4f5ade13ecafd 100644 (file)
@@ -93,6 +93,10 @@ int main(int argc, char *argv[])
       /* get file descriptors from the transfers */
       curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
 
+      /* In a real-world program you OF COURSE check the return code of the
+         function calls, *and* you make sure that maxfd is bigger than -1
+         so that the call to select() below makes sense! */
+
       rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
 
       switch(rc) {
index 0ba932f7a80ca0853f4f193503a1c7d65eba09de..b23f3c9d4db7fa852bf10de729d554d8e977710e 100644 (file)
@@ -65,6 +65,10 @@ int main(int argc, char **argv)
     /* get file descriptors from the transfers */
     curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
 
+    /* In a real-world program you OF COURSE check the return code of the
+       function calls, *and* you make sure that maxfd is bigger than -1 so
+       that the call to select() below makes sense! */
+
     rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
 
     switch(rc) {