diff options
Diffstat (limited to 'contrib/cvs/src/update.c')
-rw-r--r-- | contrib/cvs/src/update.c | 90 |
1 files changed, 54 insertions, 36 deletions
diff --git a/contrib/cvs/src/update.c b/contrib/cvs/src/update.c index 3dbe26d..af9a2bd 100644 --- a/contrib/cvs/src/update.c +++ b/contrib/cvs/src/update.c @@ -291,6 +291,8 @@ update (argc, argv) if (supported_request ("update-patches")) send_arg ("-u"); + send_arg ("--"); + if (update_build_dirs) flags |= SEND_BUILD_DIRS; @@ -318,6 +320,8 @@ update (argc, argv) error (1, errno, "could not chdir to %s", toplevel_wd); } + send_arg ("--"); + for (i = 0; i < failed_patches_count; i++) if (unlink_file (failed_patches[i]) < 0 && !existence_error (errno)) @@ -488,7 +492,7 @@ do_update (argc, argv, xoptions, xtag, xdate, xforce, local, xbuild, xaflag, follows it; someone should make sure that I did it right. */ err = start_recursion (get_linkinfo_proc, (FILESDONEPROC) NULL, (DIRENTPROC) NULL, (DIRLEAVEPROC) NULL, NULL, - argc, argv, local, which, aflag, 1, + argc, argv, local, which, aflag, LOCK_READ, preload_update_dir, 1); if (err) return (err); @@ -504,7 +508,7 @@ do_update (argc, argv, xoptions, xtag, xdate, xforce, local, xbuild, xaflag, /* call the recursion processor */ err = start_recursion (update_fileproc, update_filesdone_proc, update_dirent_proc, update_dirleave_proc, NULL, - argc, argv, local, which, aflag, 1, + argc, argv, local, which, aflag, LOCK_READ, preload_update_dir, 1); #ifdef SERVER_SUPPORT @@ -1777,46 +1781,60 @@ patch_file (finfo, vers_ts, docheckout, file_info, checksum) { fail = 1; } - else - { + } + + if (! fail) + { + struct stat file2_info; + + /* Check to make sure the patch is really shorter */ + if (CVS_STAT (file2, &file2_info) < 0) + error (1, errno, "could not stat %s", file2); + if (CVS_STAT (finfo->file, file_info) < 0) + error (1, errno, "could not stat %s", finfo->file); + if (file2_info.st_size <= file_info->st_size) + fail = 1; + } + + if (! fail) + { # define BINARY "Binary" - char buf[sizeof BINARY]; - unsigned int c; - - /* Stat the original RCS file, and then adjust it the way - that RCS_checkout would. FIXME: This is an abstraction - violation. */ - if (CVS_STAT (vers_ts->srcfile->path, file_info) < 0) - error (1, errno, "could not stat %s", vers_ts->srcfile->path); - if (chmod (finfo->file, - file_info->st_mode & ~(S_IWRITE | S_IWGRP | S_IWOTH)) - < 0) - error (0, errno, "cannot change mode of file %s", finfo->file); - if (cvswrite - && !fileattr_get (finfo->file, "_watched")) - xchmod (finfo->file, 1); - - /* Check the diff output to make sure patch will be handle it. */ - e = CVS_FOPEN (finfo->file, "r"); - if (e == NULL) - error (1, errno, "could not open diff output file %s", - finfo->fullname); - c = fread (buf, 1, sizeof BINARY - 1, e); - buf[c] = '\0'; - if (strcmp (buf, BINARY) == 0) - { - /* These are binary files. We could use diff -a, but - patch can't handle that. */ - fail = 1; - } - fclose (e); + char buf[sizeof BINARY]; + unsigned int c; + + /* Check the diff output to make sure patch will be handle it. */ + e = CVS_FOPEN (finfo->file, "r"); + if (e == NULL) + error (1, errno, "could not open diff output file %s", + finfo->fullname); + c = fread (buf, 1, sizeof BINARY - 1, e); + buf[c] = '\0'; + if (strcmp (buf, BINARY) == 0) + { + /* These are binary files. We could use diff -a, but + patch can't handle that. */ + fail = 1; } + fclose (e); } if (! fail) { Vers_TS *xvers_ts; + /* Stat the original RCS file, and then adjust it the way + that RCS_checkout would. FIXME: This is an abstraction + violation. */ + if (CVS_STAT (vers_ts->srcfile->path, file_info) < 0) + error (1, errno, "could not stat %s", vers_ts->srcfile->path); + if (chmod (finfo->file, + file_info->st_mode & ~(S_IWRITE | S_IWGRP | S_IWOTH)) + < 0) + error (0, errno, "cannot change mode of file %s", finfo->file); + if (cvswrite + && !fileattr_get (finfo->file, "_watched")) + xchmod (finfo->file, 1); + /* This stuff is just copied blindly from checkout_file. I don't really know what it does. */ xvers_ts = Version_TS (finfo, options, tag, date, @@ -2675,7 +2693,7 @@ special_file_mismatch (finfo, rev1, rev2) rev1_symlink = xreadlink (finfo->file); else { -# ifdef HAVE_ST_RDEV +# ifdef HAVE_STRUCT_STAT_ST_RDEV if (CVS_LSTAT (finfo->file, &sb) < 0) error (1, errno, "could not get file information for %s", finfo->file); @@ -2753,7 +2771,7 @@ special_file_mismatch (finfo, rev1, rev2) rev2_symlink = xreadlink (finfo->file); else { -# ifdef HAVE_ST_RDEV +# ifdef HAVE_STRUCT_STAT_ST_RDEV if (CVS_LSTAT (finfo->file, &sb) < 0) error (1, errno, "could not get file information for %s", finfo->file); |