=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/file.c,v retrieving revision 1.110 retrieving revision 1.111 diff -c -r1.110 -r1.111 *** src/usr.bin/cvs/file.c 2005/07/30 21:16:17 1.110 --- src/usr.bin/cvs/file.c 2005/08/03 14:43:08 1.111 *************** *** 1,4 **** ! /* $OpenBSD: file.c,v 1.110 2005/07/30 21:16:17 moritz Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: file.c,v 1.111 2005/08/03 14:43:08 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. *************** *** 128,134 **** size_t len; char path[MAXPATHLEN], buf[MAXNAMLEN]; FILE *ifp; - struct passwd *pwd; TAILQ_INIT(&cvs_ign_pats); --- 128,133 ---- *************** *** 140,174 **** cvs_file_ignore(cvs_ign_std[i]); /* read the cvsignore file in the user's home directory, if any */ ! pwd = getpwuid(getuid()); ! if (pwd != NULL) { ! 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"); ! if (ifp == NULL) { ! if (errno != ENOENT) ! cvs_log(LP_ERRNO, ! "failed to open user's cvsignore file " ! "`%s'", path); ! } else { ! while (fgets(buf, sizeof(buf), ifp) != NULL) { ! len = strlen(buf); ! if (len == 0) ! continue; ! if (buf[len - 1] != '\n') { ! cvs_log(LP_ERR, "line too long in `%s'", ! path); ! } ! buf[--len] = '\0'; ! cvs_file_ignore(buf); } ! (void)fclose(ifp); } } return (0); --- 139,168 ---- cvs_file_ignore(cvs_ign_std[i]); /* read the cvsignore file in the user's home directory, if any */ ! l = snprintf(path, sizeof(path), "%s/.cvsignore", cvs_homedir); ! if (l == -1 || l >= (int)sizeof(path)) { ! errno = ENAMETOOLONG; ! cvs_log(LP_ERRNO, "%s", path); ! return (-1); ! } ! ifp = fopen(path, "r"); ! if (ifp == NULL) { ! if (errno != ENOENT) ! cvs_log(LP_ERRNO, ! "failed to open user's cvsignore file `%s'", path); ! } else { ! while (fgets(buf, sizeof(buf), ifp) != NULL) { ! len = strlen(buf); ! if (len == 0) ! continue; ! if (buf[len - 1] != '\n') { ! cvs_log(LP_ERR, "line too long in `%s'", path); } ! buf[--len] = '\0'; ! cvs_file_ignore(buf); } + (void)fclose(ifp); } return (0);