Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/pax - Raise an error rather than silently creating broke...



details:   https://anonhg.NetBSD.org/src/rev/e0124d710694
branches:  trunk
changeset: 757463:e0124d710694
user:      enami <enami%NetBSD.org@localhost>
date:      Tue Aug 31 03:16:06 2010 +0000

description:
- 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.

diffstat:

 bin/pax/ar_io.c   |  7 ++++++-
 bin/pax/options.c |  9 +++++----
 2 files changed, 11 insertions(+), 5 deletions(-)

diffs (74 lines):

diff -r 70c4103ceb87 -r e0124d710694 bin/pax/ar_io.c
--- a/bin/pax/ar_io.c   Tue Aug 31 03:08:23 2010 +0000
+++ b/bin/pax/ar_io.c   Tue Aug 31 03:16:06 2010 +0000
@@ -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;
diff -r 70c4103ceb87 -r e0124d710694 bin/pax/options.c
--- a/bin/pax/options.c Tue Aug 31 03:08:23 2010 +0000
+++ b/bin/pax/options.c Tue Aug 31 03:16:06 2010 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index