Fixed not checking return value of recv()
authorJohn Hodge <[email protected]>
Mon, 7 Mar 2011 01:13:45 +0000 (09:13 +0800)
committerJohn Hodge <[email protected]>
Mon, 7 Mar 2011 01:13:45 +0000 (09:13 +0800)
src/client/main.c

index fd5915d..0995d3b 100644 (file)
@@ -287,11 +287,11 @@ int main(int argc, char *argv[])
                                gbDryRun = 1;
                                break;
                        default:
-                               if( !isdigit(argv[i][0]) ) {
-                                       fprintf(stderr, "%s: Unknown switch '%s'\n", argv[0], argv[i]);
-                                       ShowUsage();
-                                       return RV_ARGUMENTS;
-                               }
+//                             if( !isdigit(argv[i][0]) ) {
+//                                     fprintf(stderr, "%s: Unknown switch '%s'\n", argv[0], argv[i]);
+//                                     ShowUsage();
+//                                     return RV_ARGUMENTS;
+//                             }
                                if( text_argc + 1 ==  MAX_TXT_ARGS )
                                {
                                        fprintf(stderr, "ERROR: Too many arguments\n");
@@ -2160,6 +2160,10 @@ char *ReadLine(int Socket)
                }
                else {
                        len = recv(Socket, buf+bufPos, BUFSIZ-1-bufPos, 0);
+                       if( len < 0 ) {
+                               free(ret);
+                               return strdup("499 Client Connection Error\n");
+                       }
                        buf[bufPos+len] = '\0';
                }
                

UCC git Repository :: git.ucc.asn.au