savecore -z patch

Simon 'corecode' Schubert corecode at fs.ei.tum.de
Thu Dec 15 10:06:17 PST 2005


On 15.12.2005, at 17:58, Joe Talbott wrote:
savecore -z causes an illegal seek error, Here's a patch borrowed
from here:
freebsd-4's changes attached, if nobody beats me to it i'll commit it  
tonight (unless i forget).

cheers
  simon
PS: nice to find out with  
<http://oly.corecode.ath.cx/~corecode/cgi-bin/crosscgi.py? 
sourceid=33693&cmd=detail>

--
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \
Changeset for FreeBSD src/sbin/savecore/savecore.c 1.28.2.14 by maxim
o MFC a part of rev. 1.59: do not ever try to write a sparse files with
-z (compress the core dump and kernel) flag.

PR:		bin/36136
Submitted by:	Dorr H. Clark, Dmitry Frolov

Index: src/sbin/savecore/savecore.c
diff -u src/sbin/savecore/savecore.c:1.28.2.13 src/sbin/savecore/savecore.c:1.28.2.14
--- src/sbin/savecore/savecore.c:1.28.2.13	Sun Apr  7 23:17:50 2002
+++ src/sbin/savecore/savecore.c	Wed Jan  5 10:14:34 2005
@@ -42,7 +42,7 @@
 static char sccsid[] = "@(#)savecore.c	8.3 (Berkeley) 1/2/94";
 #endif
 static const char rcsid[] =
-  "$FreeBSD: src/sbin/savecore/savecore.c,v 1.28.2.13 2002/04/07 21:17:50 asmodai Exp $";
+  "$FreeBSD: src/sbin/savecore/savecore.c,v 1.28.2.14 2005/01/05 09:14:34 maxim Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -428,6 +428,9 @@
 				syslog(LOG_ERR, "%s: %m", ddname);
 			goto err2;
 		}
+		if (compress) {
+			nw = fwrite(buf, 1, nr, fp);
+		} else {
 		for (nw = 0; nw < nr; nw = he) {
 			/* find a contiguous block of zeroes */
 			for (hs = nw; hs < nr; hs += BLOCKSIZE) {
@@ -463,6 +466,7 @@
 			if (he > hs)
 				if (fseeko(fp, he - hs, SEEK_CUR) == -1)
 					break;
+			}
 		}
 		if (nw != nr) {
 			syslog(LOG_ERR, "%s: %m", path);

Attachment:
PGP.sig
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00000.pgp
Type: application/octet-stream
Size: 186 bytes
Desc: "Description: This is a digitally signed message part"
URL: <http://lists.dragonflybsd.org/pipermail/submit/attachments/20051215/0a359c6b/attachment-0014.obj>


More information about the Submit mailing list