diff options
author | 1996-05-04 07:26:05 +0000 | |
---|---|---|
committer | 1996-05-04 07:26:05 +0000 | |
commit | a5efd72c1ea322c16fcf4f56c4a28cfa28e9a0cc (patch) | |
tree | c8b6540aefffc91d775adbe26161f99c8bf0f8ed /gnu/usr.bin/cvs/src | |
parent | Don't enable Kerberos password changing by default unless a local kerberos (diff) | |
download | wireguard-openbsd-a5efd72c1ea322c16fcf4f56c4a28cfa28e9a0cc.tar.xz wireguard-openbsd-a5efd72c1ea322c16fcf4f56c4a28cfa28e9a0cc.zip |
Don't use the result of "diff" if just sending the new file would be shorter
Diffstat (limited to 'gnu/usr.bin/cvs/src')
-rw-r--r-- | gnu/usr.bin/cvs/src/update.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gnu/usr.bin/cvs/src/update.c b/gnu/usr.bin/cvs/src/update.c index 32c4c8c2fec..84d406ccb70 100644 --- a/gnu/usr.bin/cvs/src/update.c +++ b/gnu/usr.bin/cvs/src/update.c @@ -1160,6 +1160,7 @@ patch_file (file, repository, entries, srcfiles, vers_ts, update_dir, int retval = 0; int retcode = 0; int fail; + long file_size; FILE *e; *docheckout = 0; @@ -1259,6 +1260,9 @@ patch_file (file, repository, entries, srcfiles, vers_ts, update_dir, fail = 1; } + fseek(e, 0L, SEEK_END); + file_size = ftell(e); + fclose (e); } } @@ -1303,6 +1307,16 @@ patch_file (file, repository, entries, srcfiles, vers_ts, update_dir, patch can't handle that. */ fail = 1; } + else { + /* + * Don't send a diff if just sending the entire file + * would be smaller + */ + fseek(e, 0L, SEEK_END); + if (file_size < ftell(e)) + fail = 1; + } + fclose (e); } } |