[BACK]Return to proto.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / cvs

Diff for /src/usr.bin/cvs/Attic/proto.c between version 1.50 and 1.51

version 1.50, 2005/05/09 19:24:07 version 1.51, 2005/05/12 23:01:35
Line 543 
Line 543 
 int  int
 cvs_sendfile(struct cvsroot *root, const char *path)  cvs_sendfile(struct cvsroot *root, const char *path)
 {  {
         int fd;          int fd, l;
         ssize_t ret;          ssize_t ret;
         char buf[4096];          char buf[4096];
         struct stat st;          struct stat st;
Line 568 
Line 568 
                 (void)close(fd);                  (void)close(fd);
                 return (-1);                  return (-1);
         }          }
         snprintf(buf, sizeof(buf), "%lld\n", st.st_size);          l = snprintf(buf, sizeof(buf), "%lld\n", st.st_size);
           if (l == -1 || l >= (int)sizeof(buf))
                   return (-1);
   
         if (cvs_sendln(root, buf) < 0) {          if (cvs_sendln(root, buf) < 0) {
                 (void)close(fd);                  (void)close(fd);
                 return (-1);                  return (-1);
Line 665 
Line 668 
 int  int
 cvs_sendreq(struct cvsroot *root, u_int rid, const char *arg)  cvs_sendreq(struct cvsroot *root, u_int rid, const char *arg)
 {  {
         int ret;          int ret, l;
         struct cvs_req *req;          struct cvs_req *req;
   
         if (root->cr_srvin == NULL) {          if (root->cr_srvin == NULL) {
Line 686 
Line 689 
                 return (-1);                  return (-1);
         }          }
   
         snprintf(cvs_proto_buf, sizeof(cvs_proto_buf), "%s%s%s\n",          l = snprintf(cvs_proto_buf, sizeof(cvs_proto_buf), "%s%s%s\n",
             req->req_str, (arg == NULL) ? "" : " ", (arg == NULL) ? "" : arg);              req->req_str, (arg == NULL) ? "" : " ", (arg == NULL) ? "" : arg);
           if (l == -1 || l >= (int)sizeof(cvs_proto_buf))
                   return (-1);
   
         if (cvs_server_inlog != NULL)          if (cvs_server_inlog != NULL)
                 fputs(cvs_proto_buf, cvs_server_inlog);                  fputs(cvs_proto_buf, cvs_server_inlog);
Line 960 
Line 965 
 int  int
 cvs_senddir(struct cvsroot *root, CVSFILE *dir)  cvs_senddir(struct cvsroot *root, CVSFILE *dir)
 {  {
           int l;
         char lbuf[MAXPATHLEN], rbuf[MAXPATHLEN];          char lbuf[MAXPATHLEN], rbuf[MAXPATHLEN];
   
         if (dir->cf_type != DT_DIR)          if (dir->cf_type != DT_DIR)
Line 971 
Line 977 
   
         if (dir->cf_repo == NULL)          if (dir->cf_repo == NULL)
                 strlcpy(rbuf, root->cr_dir, sizeof(rbuf));                  strlcpy(rbuf, root->cr_dir, sizeof(rbuf));
         else          else {
                 snprintf(rbuf, sizeof(rbuf), "%s/%s", root->cr_dir,                  l = snprintf(rbuf, sizeof(rbuf), "%s/%s", root->cr_dir,
                     dir->cf_repo);                      dir->cf_repo);
                   if (l == -1 || l >= (int)sizeof(rbuf)) {
                           errno = ENAMETOOLONG;
                           cvs_log(LP_ERRNO, "%s", rbuf);
                           return (-1);
                   }
           }
   
   
         if ((cvs_sendreq(root, CVS_REQ_DIRECTORY, lbuf) < 0) ||          if ((cvs_sendreq(root, CVS_REQ_DIRECTORY, lbuf) < 0) ||
Line 1010 
Line 1022 
 int  int
 cvs_sendentry(struct cvsroot *root, const CVSFILE *file)  cvs_sendentry(struct cvsroot *root, const CVSFILE *file)
 {  {
           int l;
         char ebuf[128], numbuf[64];          char ebuf[128], numbuf[64];
   
         if (file->cf_type != DT_REG) {          if (file->cf_type != DT_REG) {
Line 1021 
Line 1034 
         if (file->cf_cvstat == CVS_FST_UNKNOWN)          if (file->cf_cvstat == CVS_FST_UNKNOWN)
                 return (0);                  return (0);
   
         snprintf(ebuf, sizeof(ebuf), "/%s/%s%s///", file->cf_name,          l = snprintf(ebuf, sizeof(ebuf), "/%s/%s%s///", file->cf_name,
             (file->cf_cvstat == CVS_FST_REMOVED) ? "-" : "",              (file->cf_cvstat == CVS_FST_REMOVED) ? "-" : "",
             rcsnum_tostr(file->cf_lrev, numbuf, sizeof(numbuf)));              rcsnum_tostr(file->cf_lrev, numbuf, sizeof(numbuf)));
           if (l == -1 || l >= (int)sizeof(ebuf)) {
                   errno = ENAMETOOLONG;
                   cvs_log(LP_ERRNO, "%s", ebuf);
                   return (-1);
           }
   
         return cvs_sendreq(root, CVS_REQ_ENTRY, ebuf);          return cvs_sendreq(root, CVS_REQ_ENTRY, ebuf);
 }  }

Legend:
Removed from v.1.50  
changed lines
  Added in v.1.51