[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.110 and 1.111

version 1.110, 2005/07/30 21:16:17 version 1.111, 2005/08/03 14:43:08
Line 128 
Line 128 
         size_t len;          size_t len;
         char path[MAXPATHLEN], buf[MAXNAMLEN];          char path[MAXPATHLEN], buf[MAXNAMLEN];
         FILE *ifp;          FILE *ifp;
         struct passwd *pwd;  
   
         TAILQ_INIT(&cvs_ign_pats);          TAILQ_INIT(&cvs_ign_pats);
   
Line 140 
Line 139 
                 cvs_file_ignore(cvs_ign_std[i]);                  cvs_file_ignore(cvs_ign_std[i]);
   
         /* 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());          l = snprintf(path, sizeof(path), "%s/.cvsignore", cvs_homedir);
         if (pwd != NULL) {          if (l == -1 || l >= (int)sizeof(path)) {
                 l = snprintf(path, sizeof(path), "%s/.cvsignore", pwd->pw_dir);                  errno = ENAMETOOLONG;
                 if (l == -1 || l >= (int)sizeof(path)) {                  cvs_log(LP_ERRNO, "%s", path);
                         errno = ENAMETOOLONG;                  return (-1);
                         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)
                                 cvs_log(LP_ERRNO,                          cvs_log(LP_ERRNO,
                                     "failed to open user's cvsignore file "                              "failed to open user's cvsignore file `%s'", path);
                                     "`%s'", path);          } else {
                 } else {                  while (fgets(buf, sizeof(buf), ifp) != NULL) {
                         while (fgets(buf, sizeof(buf), ifp) != NULL) {                          len = strlen(buf);
                                 len = strlen(buf);                          if (len == 0)
                                 if (len == 0)                                  continue;
                                         continue;                          if (buf[len - 1] != '\n') {
                                 if (buf[len - 1] != '\n') {                                  cvs_log(LP_ERR, "line too long in `%s'", path);
                                         cvs_log(LP_ERR, "line too long in `%s'",  
                                             path);  
                                 }  
                                 buf[--len] = '\0';  
                                 cvs_file_ignore(buf);  
                         }                          }
                         (void)fclose(ifp);                          buf[--len] = '\0';
                           cvs_file_ignore(buf);
                 }                  }
                   (void)fclose(ifp);
         }          }
   
         return (0);          return (0);

Legend:
Removed from v.1.110  
changed lines
  Added in v.1.111