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 @@ -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);