=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/file.c,v retrieving revision 1.136 retrieving revision 1.137 diff -c -r1.136 -r1.137 *** src/usr.bin/cvs/file.c 2006/04/05 01:38:55 1.136 --- src/usr.bin/cvs/file.c 2006/04/14 02:45:35 1.137 *************** *** 1,4 **** ! /* $OpenBSD: file.c,v 1.136 2006/04/05 01:38:55 ray Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: file.c,v 1.137 2006/04/14 02:45:35 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. *************** *** 253,261 **** } cfp->cf_repo = xstrdup(repo); ! if (((mkdir(path, mode) == -1) && (errno != EEXIST)) || ! (cvs_mkadmin(path, cfp->cf_root->cr_str, cfp->cf_repo, ! NULL, NULL, 0) < 0)) { cvs_file_free(cfp); return (NULL); } --- 253,261 ---- } cfp->cf_repo = xstrdup(repo); ! if ((mkdir(path, mode) == -1 && errno != EEXIST) || ! cvs_mkadmin(path, cfp->cf_root->cr_str, cfp->cf_repo, ! NULL, NULL, 0) < 0) { cvs_file_free(cfp); return (NULL); } *************** *** 575,584 **** if (cb == NULL) callit = 0; ! if ((cvs_cmdop == CVS_OP_SERVER) && (type != DT_DIR)) callit = 0; ! if ((root->cr_method == CVS_METHOD_LOCAL) && (type != DT_DIR)) callit = 0; if (!(base->cf_flags & CVS_FILE_ONDISK)) --- 575,584 ---- if (cb == NULL) callit = 0; ! if (cvs_cmdop == CVS_OP_SERVER && type != DT_DIR) callit = 0; ! if (root->cr_method == CVS_METHOD_LOCAL && type != DT_DIR) callit = 0; if (!(base->cf_flags & CVS_FILE_ONDISK)) *************** *** 593,599 **** * If we have a normal file, pass it as well. */ if (type != DT_DIR) { ! if ((cb != NULL) && ((cvs_error = cb(cf, arg)) != CVS_EX_OK)) goto fail; } else { /* --- 593,599 ---- * If we have a normal file, pass it as well. */ if (type != DT_DIR) { ! if (cb != NULL && (cvs_error = cb(cf, arg)) != CVS_EX_OK) goto fail; } else { /* *************** *** 645,651 **** /* special case */ if (*pp == '.') { ! if ((*(pp + 1) == '.') && (*(pp + 2) == '\0')) { /* request to go back to parent */ if (cf->cf_parent == NULL) { cvs_log(LP_NOTICE, --- 645,651 ---- /* special case */ if (*pp == '.') { ! if (*(pp + 1) == '.' && *(pp + 2) == '\0') { /* request to go back to parent */ if (cf->cf_parent == NULL) { cvs_log(LP_NOTICE, *************** *** 747,753 **** return (-1); } ! if ((stat(pbuf, &st) == 0) && S_ISDIR(st.st_mode)) { if (cvs_readrepo(fpath, pbuf, sizeof(pbuf)) == 0) cf->cf_repo = xstrdup(pbuf); } else { --- 747,753 ---- return (-1); } ! if (stat(pbuf, &st) == 0 && S_ISDIR(st.st_mode)) { if (cvs_readrepo(fpath, pbuf, sizeof(pbuf)) == 0) cf->cf_repo = xstrdup(pbuf); } else { *************** *** 790,796 **** struct cvs_flist dirs; int nfiles, ndirs; ! if ((flags & CF_KNOWN) && (cf->cf_cvstat == CVS_FST_UNKNOWN)) return (0); /* --- 790,796 ---- struct cvs_flist dirs; int nfiles, ndirs; ! if ((flags & CF_KNOWN) && cf->cf_cvstat == CVS_FST_UNKNOWN) return (0); /* *************** *** 847,853 **** continue; } ! if ((de->d_type != DT_DIR) && (flags & CF_NOFILES)) continue; cfp = cvs_file_lget(pbuf, flags, cf, entf, ent); --- 847,853 ---- continue; } ! if (de->d_type != DT_DIR && (flags & CF_NOFILES)) continue; cfp = cvs_file_lget(pbuf, flags, cf, entf, ent); *************** *** 860,866 **** * A file is linked to the parent , a directory * is added to the dirs SIMPLEQ list for later use. */ ! if ((cfp->cf_type != DT_DIR) && !freecf) { SIMPLEQ_INSERT_TAIL(&(cf->cf_files), cfp, cf_list); nfiles++; } else if (cfp->cf_type == DT_DIR) { --- 860,866 ---- * A file is linked to the parent , a directory * is added to the dirs SIMPLEQ list for later use. */ ! if (cfp->cf_type != DT_DIR && !freecf) { SIMPLEQ_INSERT_TAIL(&(cf->cf_files), cfp, cf_list); nfiles++; } else if (cfp->cf_type == DT_DIR) { *************** *** 886,892 **** /* * If we don't want to keep it, free it */ ! if ((cfp->cf_type != DT_DIR) && freecf) cvs_file_free(cfp); } --- 886,892 ---- /* * If we don't want to keep it, free it */ ! if (cfp->cf_type != DT_DIR && freecf) cvs_file_free(cfp); } *************** *** 899,910 **** * * (Follows the same procedure as above ... can we merge them?) */ ! while ((entf != NULL) && ((ent = cvs_ent_next(entf)) != NULL)) { if (ent->processed == 1) continue; ! if (!(flags & CF_RECURSE) && (ent->ce_type == CVS_ENT_DIR)) continue; ! if ((flags & CF_NOFILES) && (ent->ce_type != CVS_ENT_DIR)) continue; len = cvs_path_cat(fpath, ent->ce_name, pbuf, sizeof(pbuf)); --- 899,910 ---- * * (Follows the same procedure as above ... can we merge them?) */ ! while (entf != NULL && (ent = cvs_ent_next(entf)) != NULL) { if (ent->processed == 1) continue; ! if (!(flags & CF_RECURSE) && ent->ce_type == CVS_ENT_DIR) continue; ! if ((flags & CF_NOFILES) && ent->ce_type != CVS_ENT_DIR) continue; len = cvs_path_cat(fpath, ent->ce_name, pbuf, sizeof(pbuf)); *************** *** 917,923 **** goto done; } ! if ((cfp->cf_type != DT_DIR) && !freecf) { SIMPLEQ_INSERT_TAIL(&(cf->cf_files), cfp, cf_list); nfiles++; } else if (cfp->cf_type == DT_DIR) { --- 917,923 ---- goto done; } ! if (cfp->cf_type != DT_DIR && !freecf) { SIMPLEQ_INSERT_TAIL(&(cf->cf_files), cfp, cf_list); nfiles++; } else if (cfp->cf_type == DT_DIR) { *************** *** 930,936 **** goto done; } ! if ((cfp->cf_type != DT_DIR) && freecf) cvs_file_free(cfp); } --- 930,936 ---- goto done; } ! if (cfp->cf_type != DT_DIR && freecf) cvs_file_free(cfp); } *************** *** 962,968 **** } if ((cfp->cf_flags & CVS_FILE_ONDISK) && ! (cvs_file_getdir(cfp, flags, cb, arg, freecf) < 0)) goto done; if (freecf) --- 962,968 ---- } if ((cfp->cf_flags & CVS_FILE_ONDISK) && ! cvs_file_getdir(cfp, flags, cb, arg, freecf) < 0) goto done; if (freecf) *************** *** 972,978 **** ret = 0; cfp = NULL; done: ! if ((cfp != NULL) && freecf) cvs_file_free(cfp); while (!SIMPLEQ_EMPTY(&dirs)) { --- 972,978 ---- ret = 0; cfp = NULL; done: ! if (cfp != NULL && freecf) cvs_file_free(cfp); while (!SIMPLEQ_EMPTY(&dirs)) { *************** *** 1146,1152 **** if (ret == 0) type = IFTODT(st.st_mode); ! if ((flags & CF_REPO) && (type != DT_DIR)) { if ((c = strrchr(path, ',')) == NULL) return (NULL); *c = '\0'; --- 1146,1152 ---- if (ret == 0) type = IFTODT(st.st_mode); ! if ((flags & CF_REPO) && type != DT_DIR) { if ((c = strrchr(path, ',')) == NULL) return (NULL); *c = '\0'; *************** *** 1157,1163 **** cfp->cf_parent = parent; cfp->cf_entry = pent; ! if ((cfp->cf_type == DT_DIR) && (cfp->cf_parent == NULL)) cfp->cf_flags |= CVS_DIRF_BASE; if (ret == 0) { --- 1157,1163 ---- cfp->cf_parent = parent; cfp->cf_entry = pent; ! if (cfp->cf_type == DT_DIR && cfp->cf_parent == NULL) cfp->cf_flags |= CVS_DIRF_BASE; if (ret == 0) { *************** *** 1265,1271 **** xfree(c); } ! if ((cfp->cf_repo != NULL) && (cfp->cf_type == DT_DIR) && !strcmp(cfp->cf_repo, path)) cfp->cf_cvstat = CVS_FST_UPTODATE; --- 1265,1271 ---- xfree(c); } ! if (cfp->cf_repo != NULL && cfp->cf_type == DT_DIR && !strcmp(cfp->cf_repo, path)) cfp->cf_cvstat = CVS_FST_UPTODATE;