Rev 5221 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5221 | Rev 6324 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* ar.c - Archive modify and extract. |
1 | /* ar.c - Archive modify and extract. |
2 | Copyright 1991-2013 Free Software Foundation, Inc. |
2 | Copyright (C) 1991-2015 Free Software Foundation, Inc. |
Line 3... | Line 3... | ||
3 | 3 | ||
Line 4... | Line 4... | ||
4 | This file is part of GNU Binutils. |
4 | This file is part of GNU Binutils. |
5 | 5 | ||
Line 136... | Line 136... | ||
136 | 136 | ||
Line 137... | Line 137... | ||
137 | static int show_version = 0; |
137 | static int show_version = 0; |
Line -... | Line 138... | ||
- | 138 | ||
- | 139 | static int show_help = 0; |
|
- | 140 | ||
138 | 141 | #if BFD_SUPPORTS_PLUGINS |
|
- | 142 | static const char *plugin_target = "plugin"; |
|
Line 139... | Line 143... | ||
139 | static int show_help = 0; |
143 | #else |
Line 140... | Line 144... | ||
140 | 144 | static const char *plugin_target = NULL; |
|
141 | static const char *plugin_target = NULL; |
145 | #endif |
Line 157... | Line 161... | ||
157 | int interactive = 0; |
161 | int interactive = 0; |
Line 158... | Line 162... | ||
158 | 162 | ||
159 | static void |
163 | static void |
160 | mri_emul (void) |
164 | mri_emul (void) |
161 | { |
165 | { |
162 | interactive = isatty (fileno (stdin)); |
166 | interactive = 0;//isatty (fileno (stdin)); |
163 | yyparse (); |
167 | yyparse (); |
Line 164... | Line 168... | ||
164 | } |
168 | } |
165 | 169 | ||
Line 569... | Line 573... | ||
569 | case 'U': |
573 | case 'U': |
570 | deterministic = FALSE; |
574 | deterministic = FALSE; |
571 | break; |
575 | break; |
572 | case OPTION_PLUGIN: |
576 | case OPTION_PLUGIN: |
573 | #if BFD_SUPPORTS_PLUGINS |
577 | #if BFD_SUPPORTS_PLUGINS |
574 | plugin_target = "plugin"; |
- | |
575 | bfd_plugin_set_plugin (optarg); |
578 | bfd_plugin_set_plugin (optarg); |
576 | #else |
579 | #else |
577 | fprintf (stderr, _("sorry - this program has been built without plugin support\n")); |
580 | fprintf (stderr, _("sorry - this program has been built without plugin support\n")); |
578 | xexit (1); |
581 | xexit (1); |
579 | #endif |
582 | #endif |
Line 630... | Line 633... | ||
630 | break; |
633 | break; |
Line 631... | Line 634... | ||
631 | 634 | ||
632 | /* PR binutils/13493: Support plugins. */ |
635 | /* PR binutils/13493: Support plugins. */ |
633 | case OPTION_PLUGIN: |
636 | case OPTION_PLUGIN: |
634 | #if BFD_SUPPORTS_PLUGINS |
- | |
635 | plugin_target = "plugin"; |
637 | #if BFD_SUPPORTS_PLUGINS |
636 | bfd_plugin_set_plugin (optarg); |
638 | bfd_plugin_set_plugin (optarg); |
637 | #else |
639 | #else |
638 | fprintf (stderr, _("sorry - this program has been built without plugin support\n")); |
640 | fprintf (stderr, _("sorry - this program has been built without plugin support\n")); |
639 | xexit (1); |
641 | xexit (1); |
Line 687... | Line 689... | ||
687 | bindtextdomain (PACKAGE, LOCALEDIR); |
689 | bindtextdomain (PACKAGE, LOCALEDIR); |
688 | textdomain (PACKAGE); |
690 | textdomain (PACKAGE); |
Line 689... | Line 691... | ||
689 | 691 | ||
690 | program_name = argv[0]; |
692 | program_name = argv[0]; |
- | 693 | xmalloc_set_program_name (program_name); |
|
691 | xmalloc_set_program_name (program_name); |
694 | bfd_set_error_program_name (program_name); |
692 | #if BFD_SUPPORTS_PLUGINS |
695 | #if BFD_SUPPORTS_PLUGINS |
693 | bfd_plugin_set_program_name (program_name); |
696 | bfd_plugin_set_program_name (program_name); |
Line 694... | Line 697... | ||
694 | #endif |
697 | #endif |
Line 735... | Line 738... | ||
735 | 738 | ||
Line 736... | Line 739... | ||
736 | arg_index = 0; |
739 | arg_index = 0; |
737 | 740 | ||
- | 741 | if (mri_mode) |
|
738 | if (mri_mode) |
742 | { |
739 | { |
743 | default_deterministic (); |
740 | mri_emul (); |
744 | mri_emul (); |
741 | } |
745 | } |
742 | else |
746 | else |
Line 1029... | Line 1033... | ||
1029 | bfd_size_type nread, tocopy; |
1033 | bfd_size_type nread, tocopy; |
1030 | bfd_size_type ncopied = 0; |
1034 | bfd_size_type ncopied = 0; |
1031 | bfd_size_type size; |
1035 | bfd_size_type size; |
1032 | struct stat buf; |
1036 | struct stat buf; |
Line -... | Line 1037... | ||
- | 1037 | ||
- | 1038 | /* PR binutils/17533: Do not allow directory traversal |
|
- | 1039 | outside of the current directory tree. */ |
|
- | 1040 | if (! is_valid_archive_path (bfd_get_filename (abfd))) |
|
- | 1041 | { |
|
- | 1042 | non_fatal (_("illegal pathname found in archive member: %s"), |
|
- | 1043 | bfd_get_filename (abfd)); |
|
- | 1044 | free (cbuf); |
|
- | 1045 | return; |
|
- | 1046 | } |
|
1033 | 1047 | ||
1034 | if (bfd_stat_arch_elt (abfd, &buf) != 0) |
1048 | if (bfd_stat_arch_elt (abfd, &buf) != 0) |
1035 | /* xgettext:c-format */ |
1049 | /* xgettext:c-format */ |
1036 | fatal (_("internal stat error on %s"), bfd_get_filename (abfd)); |
1050 | fatal (_("internal stat error on %s"), bfd_get_filename (abfd)); |