Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/bzip2 Allow softlinks for "bzip2 -c -d" or "bzcat".



details:   https://anonhg.NetBSD.org/src/rev/c92ab2a553bd
branches:  trunk
changeset: 471680:c92ab2a553bd
user:      tron <tron%NetBSD.org@localhost>
date:      Wed Apr 07 17:58:49 1999 +0000

description:
Allow softlinks for "bzip2 -c -d" or "bzcat".

diffstat:

 usr.bin/bzip2/bzip2.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (53 lines):

diff -r c81d2449626c -r c92ab2a553bd usr.bin/bzip2/bzip2.c
--- a/usr.bin/bzip2/bzip2.c     Wed Apr 07 16:48:02 1999 +0000
+++ b/usr.bin/bzip2/bzip2.c     Wed Apr 07 17:58:49 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bzip2.c,v 1.2 1998/09/14 02:37:24 ross Exp $   */
+/*     $NetBSD: bzip2.c,v 1.3 1999/04/07 17:58:49 tron Exp $   */
 
 /*-----------------------------------------------------------*/
 /*--- A block-sorting, lossless compressor        bzip2.c ---*/
@@ -767,7 +767,7 @@
 /*--
   if in doubt, return True
 --*/
-Bool notAStandardFile ( Char* name )
+Bool notAStandardFile ( Char* name , IntNative allowSymbolicLinks )
 {
    IntNative      i;
    struct MY_STAT statBuf;
@@ -775,6 +775,7 @@
    i = MY_LSTAT ( name, &statBuf );
    if (i != 0) return True;
    if (MY_S_IFREG(statBuf.st_mode)) return False;
+   if (allowSymbolicLinks && S_ISLNK(statBuf.st_mode)) return False;
    return True;
 }
 
@@ -878,7 +879,7 @@
                 progName, inName );
       return;
    }
-   if ( srcMode != SM_I2O && notAStandardFile ( inName )) {
+   if ( srcMode != SM_I2O && notAStandardFile ( inName, False )) {
       fprintf ( stderr, "%s: Input file %s is not a normal file, skipping.\n",
                 progName, inName );
       return;
@@ -1003,7 +1004,7 @@
                 progName, inName );
       return;
    }
-   if ( srcMode != SM_I2O && notAStandardFile ( inName )) {
+   if ( srcMode != SM_I2O && notAStandardFile ( inName, srcMode == SM_F2O )) {
       fprintf ( stderr, "%s: Input file %s is not a normal file, skipping.\n",
                 progName, inName );
       return;
@@ -1133,7 +1134,7 @@
                 progName, inName );
       return;
    }
-   if ( srcMode != SM_I2O && notAStandardFile ( inName )) {
+   if ( srcMode != SM_I2O && notAStandardFile ( inName, True )) {
       fprintf ( stderr, "%s: Input file %s is not a normal file, skipping.\n",
                 progName, inName );
       return;



Home | Main Index | Thread Index | Old Index