33 lines
921 B
Text
33 lines
921 B
Text
$NetBSD: patch-ad,v 1.1 2008/03/08 18:02:00 tnn2 Exp $
|
|
|
|
--- src/call_script.cpp.orig 2007-07-15 19:05:38.000000000 +0200
|
|
+++ src/call_script.cpp
|
|
@@ -25,6 +25,10 @@
|
|
#include "userintf.h"
|
|
#include "util.h"
|
|
|
|
+#ifndef environ
|
|
+extern "C" { extern char **environ; };
|
|
+#endif
|
|
+
|
|
// Maximum length of the reason value
|
|
#define MAX_LEN_REASON 50
|
|
|
|
@@ -353,12 +357,14 @@ void t_call_script::exec_action(t_script
|
|
return;
|
|
}
|
|
|
|
- char *line_buf = NULL;
|
|
- size_t line_buf_len = 0;
|
|
+ char *line_buf = (char*)malloc(1024*64); /* it's free'd below */
|
|
+ size_t line_buf_len = 1024*64;
|
|
ssize_t num_read;
|
|
|
|
+
|
|
// Read and parse script results.
|
|
- while ((num_read = getline(&line_buf, &line_buf_len, fp_result)) != -1) {
|
|
+ while (fgets(line_buf, line_buf_len, fp_result)) {
|
|
+ num_read = strlen(line_buf);
|
|
// Strip newline if present
|
|
if (line_buf[num_read - 1] == '\n') {
|
|
line_buf[num_read - 1] = 0;
|