Wed Jul 7 11:06:37 2021 UTC ()
PR/56270: Matthias Scheler: dump fails on ffsv1: Zero c_extsize since ffsv1
does not support extended attributes.


(christos)
diff -r1.53 -r1.54 src/sbin/dump/traverse.c

cvs diff -r1.53 -r1.54 src/sbin/dump/traverse.c (expand / switch to unified diff)

--- src/sbin/dump/traverse.c 2021/06/19 13:56:34 1.53
+++ src/sbin/dump/traverse.c 2021/07/07 11:06:37 1.54
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: traverse.c,v 1.53 2021/06/19 13:56:34 christos Exp $ */ 1/* $NetBSD: traverse.c,v 1.54 2021/07/07 11:06:37 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1980, 1988, 1991, 1993 4 * Copyright (c) 1980, 1988, 1991, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#ifndef lint 33#ifndef lint
34#if 0 34#if 0
35static char sccsid[] = "@(#)traverse.c 8.7 (Berkeley) 6/15/95"; 35static char sccsid[] = "@(#)traverse.c 8.7 (Berkeley) 6/15/95";
36#else 36#else
37__RCSID("$NetBSD: traverse.c,v 1.53 2021/06/19 13:56:34 christos Exp $"); 37__RCSID("$NetBSD: traverse.c,v 1.54 2021/07/07 11:06:37 christos Exp $");
38#endif 38#endif
39#endif /* not lint */ 39#endif /* not lint */
40 40
41#include <sys/param.h> 41#include <sys/param.h>
42#include <sys/time.h> 42#include <sys/time.h>
43#include <sys/stat.h> 43#include <sys/stat.h>
44#include <ufs/ufs/dir.h> 44#include <ufs/ufs/dir.h>
45#include <ufs/ffs/fs.h> 45#include <ufs/ffs/fs.h>
46#include <ufs/ffs/ffs_extern.h> 46#include <ufs/ffs/ffs_extern.h>
47 47
48#include <assert.h> 48#include <assert.h>
49#include <ctype.h> 49#include <ctype.h>
50#include <errno.h> 50#include <errno.h>
@@ -492,26 +492,27 @@ dumpino(union dinode *dp, ino_t ino) @@ -492,26 +492,27 @@ dumpino(union dinode *dp, ino_t ino)
492 /* 492 /*
493 * Zero out the size of a snapshot so that it will be dumped 493 * Zero out the size of a snapshot so that it will be dumped
494 * as a zero length file. 494 * as a zero length file.
495 */ 495 */
496 if (DIP(dp, flags) & SF_SNAPSHOT) { 496 if (DIP(dp, flags) & SF_SNAPSHOT) {
497 DIP_SET(dp, size, 0); 497 DIP_SET(dp, size, 0);
498 DIP_SET(dp, flags, DIP(dp, flags) & ~SF_SNAPSHOT); 498 DIP_SET(dp, flags, DIP(dp, flags) & ~SF_SNAPSHOT);
499 } 499 }
500 if (!is_ufs2) { 500 if (!is_ufs2) {
501 if (needswap) 501 if (needswap)
502 ffs_dinode1_swap(&dp->dp1, &spcl.c_dinode); 502 ffs_dinode1_swap(&dp->dp1, &spcl.c_dinode);
503 else 503 else
504 spcl.c_dinode = dp->dp1; 504 spcl.c_dinode = dp->dp1;
 505 spcl.c_extsize = 0;
505 } else { 506 } else {
506 if (needswap) 507 if (needswap)
507 ffs_dinode2_swap(&dp->dp2, &dp->dp2); 508 ffs_dinode2_swap(&dp->dp2, &dp->dp2);
508 spcl.c_mode = dp->dp2.di_mode; 509 spcl.c_mode = dp->dp2.di_mode;
509 spcl.c_size = dp->dp2.di_size; 510 spcl.c_size = dp->dp2.di_size;
510 spcl.c_extsize = dp->dp2.di_extsize; 511 spcl.c_extsize = dp->dp2.di_extsize;
511 spcl.c_atime = dp->dp2.di_atime; 512 spcl.c_atime = dp->dp2.di_atime;
512 spcl.c_atimensec = dp->dp2.di_atimensec; 513 spcl.c_atimensec = dp->dp2.di_atimensec;
513 spcl.c_mtime = dp->dp2.di_mtime; 514 spcl.c_mtime = dp->dp2.di_mtime;
514 spcl.c_mtimensec = dp->dp2.di_mtimensec; 515 spcl.c_mtimensec = dp->dp2.di_mtimensec;
515 spcl.c_birthtime = dp->dp2.di_birthtime; 516 spcl.c_birthtime = dp->dp2.di_birthtime;
516 spcl.c_birthtimensec = dp->dp2.di_birthnsec; 517 spcl.c_birthtimensec = dp->dp2.di_birthnsec;
517 spcl.c_rdev = dp->dp2.di_rdev; 518 spcl.c_rdev = dp->dp2.di_rdev;