From: ueno Date: Thu, 10 Aug 2006 23:41:47 +0000 (+0000) Subject: Place sigprocmask just before poll. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b0233698bea64f038fed817da09f4e3ed245e0e;p=elisp%2Fstarttls.git Place sigprocmask just before poll. --- diff --git a/starttls.c b/starttls.c index 34a74eb..604ab46 100644 --- a/starttls.c +++ b/starttls.c @@ -57,7 +57,7 @@ extern int tls_read(int, char *, int); extern int tls_pending(); static char *opt_cert_file = NULL, *opt_key_file = NULL; -static int tls_fd; +static int tls_fd = -1; static void usage (progname) @@ -77,9 +77,9 @@ usage (progname) static void do_tls_negotiate(sig) - int sig; + int sig; { - tls_negotiate(tls_fd, opt_cert_file, opt_key_file); + tls_negotiate (tls_fd, opt_cert_file, opt_key_file); } int @@ -204,8 +204,8 @@ main (argc, argv) goto finish; for (retry = buffer; nbuffer > 0; nbuffer -= wrote, retry += wrote) { - sigprocmask (SIG_SETMASK, &act.sa_mask, &orig_mask); writefds[0].fd = tls_fd; + sigprocmask (SIG_SETMASK, &act.sa_mask, &orig_mask); ready = poll (writefds, 1, -1); sigprocmask (SIG_SETMASK, &orig_mask, NULL); if (ready == -1 && errno != EINTR) @@ -225,8 +225,8 @@ readtop: goto finish; for (retry = buffer; nbuffer > 0; nbuffer -= wrote, retry += wrote) { - sigprocmask (SIG_SETMASK, &act.sa_mask, &orig_mask); writefds[0].fd = out; + sigprocmask (SIG_SETMASK, &act.sa_mask, &orig_mask); ready = poll (writefds, 1, -1); sigprocmask (SIG_SETMASK, &orig_mask, NULL); if (ready == -1 && errno != EINTR)