Module Name: src
Committed By: enami
Date: Tue Aug 31 03:16:06 UTC 2010
Modified Files:
src/bin/pax: ar_io.c options.c
Log Message:
- Raise an error rather than silently creating broken archive
if user don't specify --force-local but opened file is actually
a local file.
- Make cpio to accept -F option as described in manpage.
- Make pax to set forcelocal flag if requested to do so.
- Add missing break statement.
To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/bin/pax/ar_io.c
cvs rdiff -u -r1.108 -r1.109 src/bin/pax/options.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/pax/ar_io.c
diff -u src/bin/pax/ar_io.c:1.49 src/bin/pax/ar_io.c:1.50
--- src/bin/pax/ar_io.c:1.49 Tue Feb 3 05:22:40 2009
+++ src/bin/pax/ar_io.c Tue Aug 31 03:16:06 2010
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94";
#else
-__RCSID("$NetBSD: ar_io.c,v 1.49 2009/02/03 05:22:40 dbj Exp $");
+__RCSID("$NetBSD: ar_io.c,v 1.50 2010/08/31 03:16:06 enami Exp $");
#endif
#endif /* not lint */
@@ -147,6 +147,11 @@
syswarn(0, errno, "Failed open on %s", name);
return -1;
}
+ if (!isrmt(arfd)) {
+ rmtclose(arfd);
+ tty_warn(0, "Not a remote file: %s", name);
+ return -1;
+ }
blksz = rdblksz = 8192;
lstrval = 1;
return 0;
Index: src/bin/pax/options.c
diff -u src/bin/pax/options.c:1.108 src/bin/pax/options.c:1.109
--- src/bin/pax/options.c:1.108 Wed Aug 25 21:36:02 2010
+++ src/bin/pax/options.c Tue Aug 31 03:16:06 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: options.c,v 1.108 2010/08/25 21:36:02 sjg Exp $ */
+/* $NetBSD: options.c,v 1.109 2010/08/31 03:16:06 enami Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94";
#else
-__RCSID("$NetBSD: options.c,v 1.108 2010/08/25 21:36:02 sjg Exp $");
+__RCSID("$NetBSD: options.c,v 1.109 2010/08/31 03:16:06 enami Exp $");
#endif
#endif /* not lint */
@@ -643,7 +643,7 @@
secure = 0;
break;
case OPT_FORCE_LOCAL:
- forcelocal = 0;
+ forcelocal = 1;
break;
case OPT_USE_COMPRESS_PROGRAM:
zflag = 1;
@@ -1677,6 +1677,7 @@
(void)fputs("\n\n", stderr);
cpio_usage();
break;
+ case 'F':
case 'I':
case 'O':
/*
@@ -1734,13 +1735,13 @@
* process Version 6 cpio format
*/
frmt = &(fsub[F_BCPIO]);
+ break;
case OPT_FORCE_LOCAL:
forcelocal = 1;
break;
case OPT_INSECURE:
secure = 0;
break;
-
case OPT_SPARSE:
/* do nothing; we already generate sparse files */
break;