/[tar]/tar/src/create.c
ViewVC logotype

Diff of /tar/src/create.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.66 by gray, Thu Nov 13 22:27:09 2003 UTC revision 1.67 by gray, Fri Nov 14 09:27:50 2003 UTC
# Line 588  start_header (const char *name, struct t Line 588  start_header (const char *name, struct t
588    union block *header;    union block *header;
589    
590    name = safer_name_suffix (name, 0);    name = safer_name_suffix (name, 0);
   if (name[0] == '.' && name[1] == 0) /*FIXME!!!*/  
     return NULL;  
591    assign_string (&st->file_name, name);    assign_string (&st->file_name, name);
592    
593    header = write_header_name (st);    header = write_header_name (st);
# Line 1087  compare_links (void const *entry1, void Line 1085  compare_links (void const *entry1, void
1085    return ((link1->dev ^ link2->dev) | (link1->ino ^ link2->ino)) == 0;    return ((link1->dev ^ link2->dev) | (link1->ino ^ link2->ino)) == 0;
1086  }  }
1087    
1088    /* Copy at most LEN bytes from SRC to DST. Terminate with NUL unless
1089       SRC is LEN characters long */
1090    static void
1091    tar_copy_str (char *dst, const char *src, size_t len)
1092    {
1093      dst[len-1] = 0;
1094      strncpy (dst, src, len);
1095    }
1096    
1097  /* Table of all non-directories that we've written so far.  Any time  /* Table of all non-directories that we've written so far.  Any time
1098     we see another, we check the table and avoid dumping the data     we see another, we check the table and avoid dumping the data
1099     again if we've done it once already.  */     again if we've done it once already.  */
# Line 1358  dump_file (char *p, int top_level, dev_t Line 1365  dump_file (char *p, int top_level, dev_t
1365                                
1366                block_ordinal = current_block_ordinal ();                block_ordinal = current_block_ordinal ();
1367                assign_string (&current_stat_info.link_name, link_name);                assign_string (&current_stat_info.link_name, link_name);
1368                if (NAME_FIELD_SIZE <= strlen (link_name))                if (NAME_FIELD_SIZE < strlen (link_name))
1369                  write_long_link (&current_stat_info);                  write_long_link (&current_stat_info);
1370    
1371                current_stat_info.stat.st_size = 0;                current_stat_info.stat.st_size = 0;
1372                header = start_header (p, &current_stat_info);                header = start_header (p, &current_stat_info);
1373                if (!header)                if (!header)
1374                  return;                  return;
1375                strncpy (header->header.linkname, link_name, NAME_FIELD_SIZE);                tar_copy_str (header->header.linkname, link_name,
1376                                NAME_FIELD_SIZE);
               /* Force null termination.  */  
               header->header.linkname[NAME_FIELD_SIZE - 1] = 0;  
1377    
1378                header->header.typeflag = LNKTYPE;                header->header.typeflag = LNKTYPE;
1379                finish_header (header, block_ordinal);                finish_header (header, block_ordinal);
# Line 1699  dump_file (char *p, int top_level, dev_t Line 1704  dump_file (char *p, int top_level, dev_t
1704              }              }
1705            buffer[size] = '\0';            buffer[size] = '\0';
1706            assign_string (&current_stat_info.link_name, buffer);            assign_string (&current_stat_info.link_name, buffer);
1707            if (size >= NAME_FIELD_SIZE)            if (size > NAME_FIELD_SIZE)
1708              write_long_link (&current_stat_info);              write_long_link (&current_stat_info);
1709    
1710            block_ordinal = current_block_ordinal ();            block_ordinal = current_block_ordinal ();
# Line 1707  dump_file (char *p, int top_level, dev_t Line 1712  dump_file (char *p, int top_level, dev_t
1712            header = start_header (p, &current_stat_info);            header = start_header (p, &current_stat_info);
1713            if (!header)            if (!header)
1714              return;              return;
1715            strncpy (header->header.linkname, buffer, NAME_FIELD_SIZE);            tar_copy_str (header->header.linkname, buffer, NAME_FIELD_SIZE);
           header->header.linkname[NAME_FIELD_SIZE - 1] = '\0';  
1716            header->header.typeflag = SYMTYPE;            header->header.typeflag = SYMTYPE;
1717            finish_header (header, block_ordinal);            finish_header (header, block_ordinal);
1718            /* nothing more to do to it */            /* nothing more to do to it */

Legend:
Removed from v.1.66  
changed lines
  Added in v.1.67

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26