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

Diff for /src/usr.bin/cvs/file.c between version 1.60 and 1.61

version 1.60, 2005/04/13 20:11:21 version 1.61, 2005/04/16 20:05:05
Line 124 
Line 124 
 int  int
 cvs_file_init(void)  cvs_file_init(void)
 {  {
         int i;          int i, l;
         size_t len;          size_t len;
         char path[MAXPATHLEN], buf[MAXNAMLEN];          char path[MAXPATHLEN], buf[MAXNAMLEN];
         FILE *ifp;          FILE *ifp;
Line 142 
Line 142 
         /* read the cvsignore file in the user's home directory, if any */          /* read the cvsignore file in the user's home directory, if any */
         pwd = getpwuid(getuid());          pwd = getpwuid(getuid());
         if (pwd != NULL) {          if (pwd != NULL) {
                 snprintf(path, sizeof(path), "%s/.cvsignore", pwd->pw_dir);                  l = snprintf(path, sizeof(path), "%s/.cvsignore", pwd->pw_dir);
                   if (l == -1 || l >= (int)sizeof(path)) {
                           errno = ENAMETOOLONG;
                           cvs_log(LP_ERRNO, "%s", path);
                           return (-1);
                   }
   
                 ifp = fopen(path, "r");                  ifp = fopen(path, "r");
                 if (ifp == NULL) {                  if (ifp == NULL) {
                         if (errno != ENOENT)                          if (errno != ENOENT)
Line 531 
Line 537 
 static int  static int
 cvs_file_getdir(CVSFILE *cf, int flags)  cvs_file_getdir(CVSFILE *cf, int flags)
 {  {
         int ret, fd;          int ret, fd, l;
         u_int ndirs;          u_int ndirs;
         long base;          long base;
         u_char *dp, *ep;          u_char *dp, *ep;
Line 558 
Line 564 
                         cvs_mkadmin(cf, 0755);                          cvs_mkadmin(cf, 0755);
   
                 /* if the CVS administrative directory exists, load the info */                  /* if the CVS administrative directory exists, load the info */
                 snprintf(pbuf, sizeof(pbuf), "%s/" CVS_PATH_CVSDIR, fpath);                  l = snprintf(pbuf, sizeof(pbuf), "%s/" CVS_PATH_CVSDIR, fpath);
                   if (l == -1 || l >= (int)sizeof(pbuf)) {
                           errno = ENAMETOOLONG;
                           cvs_log(LP_ERRNO, "%s", pbuf);
                           return (-1);
                   }
   
                 if ((stat(pbuf, &st) == 0) && S_ISDIR(st.st_mode)) {                  if ((stat(pbuf, &st) == 0) && S_ISDIR(st.st_mode)) {
                         if (cvs_readrepo(fpath, pbuf, sizeof(pbuf)) == 0) {                          if (cvs_readrepo(fpath, pbuf, sizeof(pbuf)) == 0) {
                                 cdp->cd_repo = strdup(pbuf);                                  cdp->cd_repo = strdup(pbuf);
Line 621 
Line 633 
                                 continue;                                  continue;
                         }                          }
   
                         snprintf(pbuf, sizeof(pbuf), "%s/%s", fpath,                          l = snprintf(pbuf, sizeof(pbuf), "%s/%s", fpath,
                             ent->d_name);                              ent->d_name);
                           if (l == -1 || l >= (int)sizeof(pbuf)) {
                                   errno = ENAMETOOLONG;
                                   cvs_log(LP_ERRNO, "%s", pbuf);
   
                                   (void)close(fd);
                                   return (-1);
                           }
   
                         cfp = cvs_file_lget(pbuf, flags, cf);                          cfp = cvs_file_lget(pbuf, flags, cf);
                         if (cfp == NULL) {                          if (cfp == NULL) {
                                 (void)close(fd);                                  (void)close(fd);
Line 645 
Line 665 
                  * entry in the Entries file but no file on disk                   * entry in the Entries file but no file on disk
                  */                   */
                 while ((cvsent = cvs_ent_next(cdp->cd_ent)) != NULL) {                  while ((cvsent = cvs_ent_next(cdp->cd_ent)) != NULL) {
                         snprintf(pbuf, sizeof(pbuf), "%s/%s", fpath,                          l = snprintf(pbuf, sizeof(pbuf), "%s/%s", fpath,
                             cvsent->ce_name);                              cvsent->ce_name);
                           if (l == -1 || l >= (int)sizeof(pbuf)) {
                                   errno = ENAMETOOLONG;
                                   cvs_log(LP_ERRNO, "%s", pbuf);
   
                                   (void)close(fd);
                                   return (-1);
                           }
   
                         cfp = cvs_file_lget(pbuf, flags, cf);                          cfp = cvs_file_lget(pbuf, flags, cf);
                         if (cfp != NULL) {                          if (cfp != NULL) {
                                 if (cfp->cf_type == DT_DIR) {                                  if (cfp->cf_type == DT_DIR) {

Legend:
Removed from v.1.60  
changed lines
  Added in v.1.61