/[cvs]/ccvs/src/server.c
ViewVC logotype

Diff of /ccvs/src/server.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.450.2.2 by dprice, Fri Oct 14 16:45:51 2005 UTC revision 1.450.2.3 by dprice, Sat Oct 15 01:39:25 2005 UTC
# Line 2029  serve_modified (char *arg) Line 2029  serve_modified (char *arg)
2029         non-kopt case alone.  */         non-kopt case alone.  */
2030      if (kopt != NULL)      if (kopt != NULL)
2031          serve_is_modified (arg);          serve_is_modified (arg);
2032    
2033        /* If an OpenPGP signature was sent for this file, write it to a temp
2034         * file.
2035         */
2036        if (sig_buf)
2037        {
2038            char *sigfile_name, *sig_data;
2039            int fd, rc;
2040            size_t got;
2041    
2042            /* Write the file.  */
2043            sigfile_name = Xasprintf ("%s%s%s", BAKPREFIX, arg, ".sig");
2044            fd = CVS_OPEN (sigfile_name, O_WRONLY | O_CREAT | O_TRUNC, 0600);
2045            if (fd < 0)
2046            {
2047                int save_errno = errno;
2048                if (alloc_pending (40 + strlen (arg)))
2049                    sprintf (pending_error_text, "E cannot open `%s'",
2050                             sigfile_name);
2051                pending_error = save_errno;
2052                return;
2053            }
2054    
2055            while (!buf_empty_p (sig_buf))
2056            {
2057                if ((rc = buf_read_data (sig_buf, buf_length (sig_buf), &sig_data,
2058                                         &got)))
2059                {
2060                    /* Since !buf_empty_p confirmed that the buffer was not empty,
2061                     * it should be impossible to get EOF here.
2062                     */
2063                    assert (rc != -1);
2064    
2065                    if (rc == -2)
2066                        pending_error = ENOMEM;
2067                    else if (alloc_pending (80))
2068                        sprintf (pending_error_text,
2069                                 "E error reading signature buffer.");
2070                    pending_error = rc;
2071                    return;
2072                }
2073    
2074                if (write (fd, sig_data, got) < 0)
2075                {
2076                    int save_errno = errno;
2077                    if (alloc_pending (80 + strlen (sigfile_name)))
2078                        sprintf (pending_error_text,
2079                                 "E error writing temporary signature file `%s'.",
2080                                 sigfile_name);
2081                    pending_error = save_errno;
2082                    return;
2083                 }
2084            }
2085    
2086            if (close (fd) < 0
2087                && alloc_pending_warning (80 + strlen (sigfile_name)))
2088                sprintf (pending_warning_text,
2089                         "E error closing temporary signature file `%s'.",
2090                         sigfile_name);
2091            free (sigfile_name);
2092    
2093            /* We're done with the SIG_BUF.  */
2094            buf_free (sig_buf);
2095            sig_buf = NULL;
2096        }
2097  }  }
2098    
2099    
# Line 2038  serve_signature (char *arg) Line 2103  serve_signature (char *arg)
2103  {  {
2104      int status;      int status;
2105    
2106      if (!sig_buf)      if (sig_buf)
2107        {
2108            if (alloc_pending (80))
2109                sprintf (pending_error_text,
2110    "E Multiple Signature requests received for a single file.");
2111        }
2112        else
2113          sig_buf = buf_nonio_initialize (NULL);          sig_buf = buf_nonio_initialize (NULL);
2114    
2115      status = read_signature (buf_from_net, sig_buf);      status = read_signature (buf_from_net, sig_buf);
2116      if (status)      if (status)
2117      {      {

Legend:
Removed from v.1.450.2.2  
changed lines
  Added in v.1.450.2.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26