]> granicus.if.org Git - icinga2/commitdiff
Increase command buffer to 128kB
authorGunnar Beutner <gunnar.beutner@netways.de>
Tue, 8 Jul 2014 06:32:42 +0000 (08:32 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 8 Jul 2014 06:32:42 +0000 (08:32 +0200)
fixes #6662

components/compat/externalcommandlistener.cpp

index 91ad0a50fba7e4425591ed437266cae4f47ecf07..437cf6943ed2ef4b00e895c5b3df53498e132135 100644 (file)
@@ -119,9 +119,10 @@ void ExternalCommandListener::CommandPipeThread(const String& commandPath)
                        return;
                }
 
-               char line[2048];
+               const int linesize = 128 * 1024;
+               char *line = new char[linesize];
 
-               while (fgets(line, sizeof(line), fp) != NULL) {
+               while (fgets(line, linesize, fp) != NULL) {
                        // remove trailing new-line
                        while (strlen(line) > 0 &&
                            (line[strlen(line) - 1] == '\r' || line[strlen(line) - 1] == '\n'))
@@ -140,6 +141,7 @@ void ExternalCommandListener::CommandPipeThread(const String& commandPath)
                        }
                }
 
+               delete line;
                fclose(fp);
        }
 }