diff options
author | Cy Schubert <cy@FreeBSD.org> | 2011-09-09 19:41:42 +0000 |
---|---|---|
committer | Cy Schubert <cy@FreeBSD.org> | 2011-09-09 19:41:42 +0000 |
commit | 7e46f6989fe32f18b147496bf5118b2ecb01d083 (patch) | |
tree | 5a84cf01d6151dacf9c0dcd98c290313a741936b /security/bcwipe/files/patch-wipe.c | |
parent | - Update to 1.1 (diff) |
Update 1.6.5 --> 1.9.8
Assume maintainership of this port.
Notes
Notes:
svn path=/head/; revision=281534
Diffstat (limited to 'security/bcwipe/files/patch-wipe.c')
-rw-r--r-- | security/bcwipe/files/patch-wipe.c | 69 |
1 files changed, 16 insertions, 53 deletions
diff --git a/security/bcwipe/files/patch-wipe.c b/security/bcwipe/files/patch-wipe.c index 079ca0fce034..fee492a49a87 100644 --- a/security/bcwipe/files/patch-wipe.c +++ b/security/bcwipe/files/patch-wipe.c @@ -1,25 +1,15 @@ ---- wipe.c.orig Tue Mar 6 10:24:24 2007 -+++ wipe.c Fri Mar 9 09:43:00 2007 -@@ -17,6 +17,9 @@ - - char wipe_c[]="$Id: wipe.c,v 1.96 2006/10/31 11:03:31 pav Rev 1.6-5 $"; - -+#ifndef SOLARIS -+#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4))) -+#endif - - #include <stdio.h> - #include <limits.h> -@@ -909,9 +912,17 @@ +--- wipe.c.orig 2011-01-27 07:30:06.000000000 -0800 ++++ wipe.c 2011-09-09 12:13:50.626914657 -0700 +@@ -1521,9 +1521,17 @@ /*size on success */ long long int find_size_by_reading(int fd) { + struct stat st; - off_t limit,pos,prev,b_pos=0; + off_t limit, pos, lPos, prev, b_pos = 0; - char buf[64]; - int i; + char buf[512]; -+ int i, j; ++ int i,j; + + if ( OK != fstat(fd,&st) ) + { @@ -28,41 +18,14 @@ + } + j = !(S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode)) ? 1 : sizeof(buf); - for ( limit=0x7f,i=sizeof(limit);--i; ) - limit = (limit <<8)|0xff; -@@ -925,7 +936,7 @@ - fprintf(stderr,"lseek error: %s\n",strerror(errno)); - return 0; - } -- if ( 1 != read(fd,buf,1) ) -+ if ( j != read(fd,buf,j) ) - { - prev=pos; - pos=(pos+b_pos)>>1; -@@ -1172,6 +1183,9 @@ - - if ( S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode) ) - { -+#if defined(__FreeBSD__) || defined(SOLARIS) -+ size = ~((long long int)1 << (sizeof(size)*8-1)); -+#else - size = 0; - - #ifdef BLKGETSIZE -@@ -1191,6 +1205,7 @@ - if ( 0 == size || ERROR == size ) - for ( size=0x7f,i=sizeof(size);--i; ) - size = (size <<8)|0xff; -+#endif - } - - for ( i=0, op=0 ; i < o_pas_num; i++ ) -@@ -1202,7 +1217,7 @@ - lseek64(fd,0,SEEK_SET); - while ( s < size ) - { -- j = size - s < BUFFSIZE ? size - s : BUFFSIZE; -+ j = size - s < BUFFSIZE && !(S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode)) ? size - s : BUFFSIZE; - fill_buff(buff, j, i,s); - - if ( ERROR == (j=write(fd,(const void *)buff,j)) ) + for ( limit=0x7f, i=sizeof(limit); --i; ) + limit = (limit << 8) | 0xff; +@@ -1547,7 +1555,7 @@ + + lPos = lseek_f( fd, pos, SEEK_SET ); + +- if ( ( lPos != pos ) || ( 1 != read(fd, buf, 1) ) ) { ++ if ( ( lPos != pos ) || ( 1 != read(fd, buf, j) ) ) { + prev = pos; + pos = (pos+b_pos) >> 1; + } else { |