* addr2line.c (process_file): Change function from void to returning an int. Return 0 upon success, 1 otherwise.
(main): Use return value from process_file as the exit value.
* ar.c (ranlib_only): Change function from void to returning an int. Return 0 upon success, 1 otherwise.
(ranlib_touch): Likewise.
(main): Use return value from ranlib functions as exit value.
* objcopy.c (add_specific_symbol): Set status to 1 if get_file_size fails.
(copy_file): Likewise.
(strip_main): Likewise.
(copy_main): Likewise.
* objdump.c (display_file): Set exit_status to 1 if get_file_size fails.
* size.c (display_file): Set return_code to 1 if get_file_size fails.
+2006-08-06 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/3001
+ * addr2line.c (process_file): Change function from void to
+ returning an int. Return 0 upon success, 1 otherwise.
+ (main): Use return value from process_file as the exit value.
+ * ar.c (ranlib_only): Change function from void to returning an
+ int. Return 0 upon success, 1 otherwise.
+ (ranlib_touch): Likewise.
+ (main): Use return value from ranlib functions as exit value.
+ * objcopy.c (add_specific_symbol): Set status to 1 if get_file_size
+ fails.
+ (copy_file): Likewise.
+ (strip_main): Likewise.
+ (copy_main): Likewise.
+ * objdump.c (display_file): Set exit_status to 1 if get_file_size
+ fails.
+ * size.c (display_file): Set return_code to 1 if get_file_size
+ fails.
+
2006-08-02 Thiemo Seufer <ths@mips.com>
Nigel Stephens <nigel@mips.com>
static void find_address_in_section (bfd *, asection *, void *);
static void find_offset_in_section (bfd *, asection *);
static void translate_addresses (bfd *, asection *);
-static void process_file (const char *, const char *, const char *);
\f
/* Print a usage message to STREAM and exit with STATUS. */
}
}
-/* Process a file. */
+/* Process a file. Returns an exit value for main(). */
-static void
+static int
process_file (const char *file_name, const char *section_name,
const char *target)
{
char **matching;
if (get_file_size (file_name) < 1)
- return;
+ return 1;
abfd = bfd_openr (file_name, target);
if (abfd == NULL)
}
bfd_close (abfd);
+
+ return 0;
}
\f
int
addr = argv + optind;
naddr = argc - optind;
- process_file (file_name, section_name, target);
-
- return 0;
+ return process_file (file_name, section_name, target);
}
/* ar.c - Archive modify and extract.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005
+ 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of GNU Binutils.
(bfd *, char **files_to_replace, bfd_boolean quick);
static void print_descr (bfd * abfd);
static void write_archive (bfd *);
-static void ranlib_only (const char *archname);
-static void ranlib_touch (const char *archname);
+static int ranlib_only (const char *archname);
+static int ranlib_touch (const char *archname);
static void usage (int);
\f
/** Globals and flags */
if (is_ranlib)
{
+ int status = 0;
bfd_boolean touch = FALSE;
if (argc < 2
while (arg_index < argc)
{
if (! touch)
- ranlib_only (argv[arg_index]);
+ status |= ranlib_only (argv[arg_index]);
else
- ranlib_touch (argv[arg_index]);
+ status |= ranlib_touch (argv[arg_index]);
++arg_index;
}
- xexit (0);
+ xexit (status);
}
if (argc == 2 && strcmp (argv[1], "-M") == 0)
if ((operation == none || operation == print_table)
&& write_armap == 1)
- {
- ranlib_only (argv[arg_index]);
- xexit (0);
- }
+ xexit (ranlib_only (argv[arg_index]));
if (operation == none)
fatal (_("no operation specified"));
output_filename = NULL;
}
-static void
+static int
ranlib_only (const char *archname)
{
bfd *arch;
if (get_file_size (archname) < 1)
- return;
+ return 1;
write_armap = 1;
arch = open_inarch (archname, (char *) NULL);
if (arch == NULL)
xexit (1);
write_archive (arch);
+ return 0;
}
/* Update the timestamp of the symbol map of an archive. */
-static void
+static int
ranlib_touch (const char *archname)
{
#ifdef __GO32__
char **matching;
if (get_file_size (archname) < 1)
- return;
+ return 1;
f = open (archname, O_RDWR | O_BINARY, 0);
if (f < 0)
{
if (! bfd_close (arch))
bfd_fatal (archname);
#endif
+ return 0;
}
/* Things which are interesting to map over all or some of the files: */
size = get_file_size (filename);
if (size == 0)
- return;
+ {
+ status = 1;
+ return;
+ }
buffer = xmalloc (size + 2);
f = fopen (filename, FOPEN_RT);
if (get_file_size (input_filename) < 1)
{
- non_fatal (_("error: the input file '%s' is empty"), input_filename);
status = 1;
return;
}
char *tmpname;
if (get_file_size (argv[i]) < 1)
- continue;
+ {
+ status = 1;
+ continue;
+ }
if (preserve_dates)
/* No need to check the return value of stat().
tmpname = output_file;
else
tmpname = make_tempname (argv[i]);
- status = 0;
+ status = 0;
copy_file (argv[i], tmpname, input_target, output_target);
if (status == 0)
{
free (tmpname);
}
- return 0;
+ return status;
}
static int
size = get_file_size (s + 1);
if (size < 1)
- break;
+ {
+ status = 1;
+ break;
+ }
pa = xmalloc (sizeof (struct section_add));
bfd *arfile = NULL;
if (get_file_size (filename) < 1)
- return;
+ {
+ exit_status = 1;
+ return;
+ }
file = bfd_openr (filename, target);
if (file == NULL)
/* size.c -- report size of various sections of an executable file.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Binutils.
bfd *file;
if (get_file_size (filename) < 1)
- return;
+ {
+ return_code = 1;
+ return;
+ }
file = bfd_openr (filename, target);
if (file == NULL)