aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-11-08 19:41:28 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-11-08 19:41:28 +0000
commitfacfa19cdd4d00944c53cc051020023256811928 (patch)
tree91aa1e92177b142a0094847b2ac18fccb378f581 /src
parent3347ced89962af92d98ccba988ad39b6fceb320e (diff)
weirdo hack to fix debian bug report 278691:
'curl -v writes debugging to its network socket if stderr is closed'
Diffstat (limited to 'src')
-rw-r--r--src/config.h.in6
-rw-r--r--src/main.c23
2 files changed, 29 insertions, 0 deletions
diff --git a/src/config.h.in b/src/config.h.in
index 45eab3694..5636cbeeb 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -109,3 +109,9 @@
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
+
+/* Define to 1 if you have the `ftruncate' function. */
+#undef HAVE_FTRUNCATE
+
+/* Define to 1 if you have the `pipe' function. */
+#undef HAVE_PIPE
diff --git a/src/main.c b/src/main.c
index 2fdb1eb24..4f6c62a61 100644
--- a/src/main.c
+++ b/src/main.c
@@ -3771,12 +3771,35 @@ operate(struct Configurable *config, int argc, char *argv[])
return res;
}
+static void checkfds(void);
+
+static void checkfds(void)
+{
+#ifdef HAVE_PIPE
+ int fd[2] = { STDIN_FILENO, STDIN_FILENO };
+ while( fd[0] == STDIN_FILENO ||
+ fd[0] == STDOUT_FILENO ||
+ fd[0] == STDERR_FILENO ||
+ fd[1] == STDIN_FILENO ||
+ fd[1] == STDOUT_FILENO ||
+ fd[1] == STDERR_FILENO )
+ pipe(fd);
+
+ close(fd[0]);
+ close(fd[1]);
+#endif
+}
+
+
+
int main(int argc, char *argv[])
{
int res;
struct Configurable config;
memset(&config, 0, sizeof(struct Configurable));
+ checkfds();
+
res = operate(&config, argc, argv);
free_config_fields(&config);