kiss-repository

personal kiss repository
git clone git://git.ckyln.com/~cem/kiss-repository.git
Log | Files | Refs | Submodules | README | LICENSE

nvi-08-lfs.patch (1067B)


      1 #! /bin/sh /usr/share/dpatch/dpatch-run
      2 ## 08lfs.dpatch by  <hesso@pool.math.tu-berlin.de>
      3 ##
      4 ## DP: Insert a safety check to save large files from being overwritten.
      5 
      6 @DPATCH@
      7 diff -Naur nvi-1.81.6.orig/common/exf.c nvi-1.81.6/common/exf.c
      8 --- nvi-1.81.6.orig/common/exf.c	2007-11-18 17:41:42.000000000 +0100
      9 +++ nvi-1.81.6/common/exf.c	2008-05-01 18:09:55.000000000 +0200
     10 @@ -157,6 +157,18 @@
     11  	 */
     12  	if (file_spath(sp, frp, &sb, &exists))
     13  		return (1);
     14 +        /*
     15 +         * On LFS systems, it's possible that stat returned an error because
     16 +         * the file is >2GB, which nvi would normally treat as "doesn't exist"
     17 +         * and eventually overwrite. That's no good. Rather than mess with
     18 +         * every stat() call in file_spath, we'll just check again here.
     19 +         */
     20 +        if (!exists && stat(frp->name, &sb)) {
     21 +            if (errno == EOVERFLOW) {
     22 +                msgq(sp, M_ERR,  "File too large (>2GB, probably)");
     23 +                goto err;
     24 +            }
     25 +        }
     26  
     27  	/*
     28  	 * Check whether we already have this file opened in some