Subject: Re: bin/34265: pax truncates archive when appending fails.
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,>
From: dieter roelants <dieter.NetBSD@pandora.be>
List: netbsd-bugs
Date: 08/24/2006 12:00:14
The following reply was made to PR bin/34265; it has been noted by GNATS.
From: dieter roelants <dieter.NetBSD@pandora.be>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/34265: pax truncates archive when appending fails.
Date: Thu, 24 Aug 2006 13:57:53 +0200
--=-VUKdaqZCS5NOptF6gMCF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
And now in real clear text... (I hope)
--=-VUKdaqZCS5NOptF6gMCF
Content-Type: text/x-patch; charset=us-ascii; name=patch
Content-Disposition: attachment; filename=patch
Content-Transfer-Encoding: quoted-printable
Index: ar_subs.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/bin/pax/ar_subs.c,v
retrieving revision 1.49
diff -u -r1.49 ar_subs.c
--- ar_subs.c 11 Feb 2006 11:04:57 -0000 1.49
+++ ar_subs.c 24 Aug 2006 10:18:59 -0000
@@ -867,7 +867,18 @@
/*
* go to the writing phase to add the new members
*/
- return wr_archive(arcn, 1);
+ res =3D wr_archive(arcn, 1);
+ if (res =3D=3D 1) {
+ /*
+ * wr_archive failed in some way, but before any files were
+ * added. These are the only steps needed to cleanup (and
+ * not truncate the archive).
+ */
+ wr_fin();
+ (void)sigprocmask(SIG_BLOCK, &s_mask, (sigset_t *)NULL);
+ ar_close();
+ }
+ return res;
}
=20
/*
--=-VUKdaqZCS5NOptF6gMCF--