summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2013-07-11 13:28:47 +0200
committerYang Tse <yangsita@gmail.com>2013-07-11 13:31:06 +0200
commit2022b10e50c5387ee9f457390fb76f1467f9b9f6 (patch)
tree6ef6c3e5dea5868a5145f13620ebe0bab0436b4e
parent45339625bc85b29225a2035a57eceda43206dd1e (diff)
downloadcurl-2022b10e50c5387ee9f457390fb76f1467f9b9f6.tar.gz
easy.c: fix global declaration shadowing
-rw-r--r--lib/easy.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/easy.c b/lib/easy.c
index 9d4e01176..b82a548cb 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -87,7 +87,7 @@
#ifdef SIGPIPE_IGNORE
struct sigpipe_ignore {
- struct sigaction pipe;
+ struct sigaction old_pipe_act;
bool no_signal;
};
@@ -107,8 +107,9 @@ static void sigpipe_ignore(struct SessionHandle *data,
if(!data->set.no_signal) {
struct sigaction action;
/* first, extract the existing situation */
- sigaction(SIGPIPE, NULL, &ig->pipe);
- action = ig->pipe;
+ memset(&ig->old_pipe_act, 0, sizeof(struct sigaction));
+ sigaction(SIGPIPE, NULL, &ig->old_pipe_act);
+ action = ig->old_pipe_act;
/* ignore this signal */
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
@@ -124,13 +125,13 @@ static void sigpipe_restore(struct sigpipe_ignore *ig)
{
if(!ig->no_signal)
/* restore the outside state */
- sigaction(SIGPIPE, &ig->pipe, NULL);
+ sigaction(SIGPIPE, &ig->old_pipe_act, NULL);
}
#else
/* for systems without sigaction */
-#define sigpipe_ignore(x,y)
-#define sigpipe_restore(x)
+#define sigpipe_ignore(x,y) Curl_nop_stmt
+#define sigpipe_restore(x) Curl_nop_stmt
#define SIGPIPE_VARIABLE(x)
#endif
@@ -472,7 +473,7 @@ CURLcode curl_easy_perform(CURL *easy)
int without_fds = 0; /* count number of consecutive returns from
curl_multi_wait() without any filedescriptors */
struct timeval before;
- SIGPIPE_VARIABLE(pipe);
+ SIGPIPE_VARIABLE(pipe_st);
if(!easy)
return CURLE_BAD_FUNCTION_ARGUMENT;
@@ -505,7 +506,7 @@ CURLcode curl_easy_perform(CURL *easy)
return CURLE_FAILED_INIT;
}
- sigpipe_ignore(data, &pipe);
+ sigpipe_ignore(data, &pipe_st);
/* assign this after curl_multi_add_handle() since that function checks for
it and rejects this handle otherwise */
@@ -563,7 +564,7 @@ CURLcode curl_easy_perform(CURL *easy)
a failure here, room for future improvement! */
(void)curl_multi_remove_handle(multi, easy);
- sigpipe_restore(&pipe);
+ sigpipe_restore(&pipe_st);
/* The multi handle is kept alive, owned by the easy handle */
return code;
@@ -576,14 +577,14 @@ CURLcode curl_easy_perform(CURL *easy)
void curl_easy_cleanup(CURL *curl)
{
struct SessionHandle *data = (struct SessionHandle *)curl;
- SIGPIPE_VARIABLE(pipe);
+ SIGPIPE_VARIABLE(pipe_st);
if(!data)
return;
- sigpipe_ignore(data, &pipe);
+ sigpipe_ignore(data, &pipe_st);
Curl_close(data);
- sigpipe_restore(&pipe);
+ sigpipe_restore(&pipe_st);
}
/*