changeset-406706.diff.txt

corecode, 12/15/2005 06:11 PM

Download (1.25 KB)

 
1
Changeset for FreeBSD src/sbin/savecore/savecore.c 1.28.2.14 by maxim
2
o MFC a part of rev. 1.59: do not ever try to write a sparse files with
3
-z (compress the core dump and kernel) flag.
4

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

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

    
40