]> Dogcows Code - chaz/tar/blobdiff - src/list.c
Relicense under GPLv3
[chaz/tar] / src / list.c
index 8a97b03786aa532f5f7ea12cccbe563ff1e6c91f..c9cdf8246fbf2134f7846aacc4ea91ee9532f195 100644 (file)
@@ -1,13 +1,13 @@
 /* List a tar archive, with support routines for reading a tar archive.
 
    Copyright (C) 1988, 1992, 1993, 1994, 1996, 1997, 1998, 1999, 2000,
-   2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   2001, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
    Written by John Gilmore, on 1985-08-26.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
-   Free Software Foundation; either version 2, or (at your option) any later
+   Free Software Foundation; either version 3, or (at your option) any later
    version.
 
    This program is distributed in the hope that it will be useful, but
@@ -472,9 +472,27 @@ read_header (bool raw_extended_headers)
 static char *
 decode_xform (char *file_name, void *data)
 {
-  bool link_target = *(bool*)data;
-  file_name = safer_name_suffix (file_name, link_target,
-                                absolute_names_option);
+  xform_type type = *(xform_type*)data;
+
+  switch (type)
+    {
+    case xform_symlink:
+      /* FIXME: It is not quite clear how and to which extent are the symbolic
+        links subject to filename transformation.  In the absence of another
+        solution, symbolic links are exempt from component stripping and
+        name suffix normalization, but subject to filename transformation
+        proper. */ 
+      return file_name;
+      
+    case xform_link:
+      file_name = safer_name_suffix (file_name, true, absolute_names_option);
+      break;
+      
+    case xform_regfile:
+      file_name = safer_name_suffix (file_name, false, absolute_names_option);
+      break;
+    }
+  
   if (strip_name_components)
     {
       size_t prefix_len = stripped_prefix_len (file_name,
@@ -487,9 +505,9 @@ decode_xform (char *file_name, void *data)
 }
 
 bool
-transform_member_name (char **pinput, bool lnk)
+transform_member_name (char **pinput, xform_type type)
 {
-  return transform_name_fp (pinput, decode_xform, &lnk);
+  return transform_name_fp (pinput, decode_xform, &type);
 }
 
 #define ISOCTAL(c) ((c)>='0'&&(c)<='7')
@@ -610,7 +628,7 @@ decode_header (union block *header, struct tar_stat_info *stat_info,
        stat_info->is_dumpdir = true;
     }
 
-  transform_member_name (&stat_info->file_name, false);
+  transform_member_name (&stat_info->file_name, xform_regfile);
 }
 
 /* Convert buffer at WHERE0 of size DIGS from external format to
This page took 0.021068 seconds and 4 git commands to generate.