svn commit: samba r6827 - in trunk/source/registry: .

jerry at samba.org jerry at samba.org
Mon May 16 19:55:52 GMT 2005


Author: jerry
Date: 2005-05-16 19:55:51 +0000 (Mon, 16 May 2005)
New Revision: 6827

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6827

Log:
fix a problem writing out the regf block
Modified:
   trunk/source/registry/regfio.c


Changeset:
Modified: trunk/source/registry/regfio.c
===================================================================
--- trunk/source/registry/regfio.c	2005-05-16 19:50:11 UTC (rev 6826)
+++ trunk/source/registry/regfio.c	2005-05-16 19:55:51 UTC (rev 6827)
@@ -37,7 +37,7 @@
 	/* check for end of file */
 
 	if ( sys_fstat( file->fd, &sbuf ) ) {
-		DEBUG(0,("read_block: stat() failed! (%s)\n", strerror(errno)));
+		DEBUG(0,("write_block: stat() failed! (%s)\n", strerror(errno)));
 		return -1;
 	}
 
@@ -1216,8 +1216,18 @@
 		unix_to_nt_time( &file->mtime, time(NULL) );
 
 		if ( read_block( file, &ps, 0, REGF_BLOCKSIZE ) != -1 ) {
+			/* now use for writing */
+			prs_switch_type( &ps, MARSHALL );
+
+			/* stream the block once, generate the checksum, 
+			   and stream it again */
+			prs_set_offset( &ps, 0 );
+			prs_regf_block( "regf_blocK", &ps, 0, file );
 			file->checksum = regf_block_checksum( &ps );
+			prs_set_offset( &ps, 0 );
 			prs_regf_block( "regf_blocK", &ps, 0, file );
+
+			/* now we are ready to write it to disk */
 			if ( write_block( file, &ps, 0 ) == -1 )
 				DEBUG(0,("regfio_close: failed to update the regf header block!\n"));
 		}



More information about the samba-cvs mailing list